#include <bits/stdc++.h>
using namespace std;
int n, c[64], a[64][64];
vector<pair<pair<int, int>, pair<int, int>>> res;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      int _a = i, _b = j;
      for (int x = i; x <= n; x++) {
        for (int y = 1; y <= c[x]; y++) {
          if (y < j) {
            continue;
          }
          if (a[x][y] > a[i - 1][j] && a[x][y] > a[i][j - 1] &&
              a[x][y] < a[_a][_b]) {
            _a = x, _b = y;
          }
        }
      }
      if (_a != i || _b != j) {
        res.push_back({{i, j}, {_a, _b}});
        swap(a[i][j], a[_a][_b]);
      }
    }
  }
  cout << res.size() << endl;
  for (auto i : res) {
    cout << i.first.first << " " << i.first.second << " " << i.second.first
         << " " << i.second.second << endl;
  }
  return 0;
}
