#include <bits/stdc++.h>
using namespace std;
struct event {
  long long need, cur;
};
void swap(event &a, event &b) {
  event e;
  e.cur = a.cur;
  a.cur = b.cur;
  b.cur = e.cur;
  return;
}
int main() {
  long long n, c[100], cnt = 1;
  event a[100][100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++, cnt++) {
      cin >> a[i][j].cur;
      a[i][j].need = cnt;
    }
  }
  cnt = 0;
  long long ans[2500][5];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      for (int ii = 0; ii < n; ii++) {
        for (int jj = 0; jj < c[i]; jj++) {
          if ((i != ii || j != jj) && a[i][j].need == a[ii][jj].cur) {
            swap(a[i][j], a[ii][jj]);
            cnt++;
            ans[cnt - 1][0] = i + 1;
            ans[cnt - 1][1] = j + 1;
            ans[cnt - 1][2] = ii + 1;
            ans[cnt - 1][3] = jj + 1;
          }
        }
      }
    }
  }
  cout << cnt << "\n";
  for (int i = 0; i < cnt; i++) {
    for (int j = 0; j < 4; j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
