#include <bits/stdc++.h>
using namespace std;
int n;
int c[55];
int row[2555];
int col[2555];
int tbl[55][55];
vector<pair<pair<int, int>, pair<int, int> > > ans;
int main() {
  cin >> n;
  int k = 1;
  for (int(i) = (1); (i) <= (n); ++(i)) {
    cin >> c[i];
    for (int(j) = (1); (j) <= (c[i]); ++(j)) {
      row[k] = i;
      col[k] = j;
      k++;
    }
  }
  for (int(i) = (1); (i) <= (n); ++(i)) {
    for (int(j) = (1); (j) <= (c[i]); ++(j)) {
      cin >> tbl[i][j];
    }
  }
  int cur;
  for (int(i) = (1); (i) <= (n); ++(i)) {
    for (int(j) = (1); (j) <= (c[i]); ++(j)) {
      cur = tbl[i][j];
      while (row[cur] != i || col[cur] != j) {
        swap(tbl[i][j], tbl[row[cur]][col[cur]]);
        ans.push_back(make_pair((make_pair((i), (j))),
                                (make_pair((row[cur]), (col[cur])))));
        cur = tbl[i][j];
      }
    }
  }
  cout << ans.size() << endl;
  if (ans.size() > 0) {
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first.first << " " << ans[i].first.second << " "
           << ans[i].second.first << " " << ans[i].second.second << endl;
    }
  }
  return 0;
}
