#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int> > M;
int n, a[55];
int table[55][55];
int order[5050], ans[5050][4];
int main() {
  while (~scanf("%d", &n)) {
    M.clear();
    for (int i = 1; i <= n; i++) scanf("%d", a + i);
    int num = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= a[i]; j++) {
        scanf("%d", &table[i][j]);
        order[num++] = table[i][j];
        M[table[i][j]] = pair<int, int>(i, j);
      }
    }
    sort(order, order + num);
    int k = 0, cnt = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= a[i]; j++) {
        if (order[k] != table[i][j]) {
          ans[cnt][0] = i;
          ans[cnt][1] = j;
          int nx = M[order[k]].first;
          int ny = M[order[k]].second;
          ans[cnt][2] = nx;
          ans[cnt++][3] = ny;
          M[table[i][j]] = pair<int, int>(nx, ny);
          swap(table[i][j], table[nx][ny]);
        }
        k++;
      }
    }
    printf("%d\n", cnt);
    for (int i = 0; i < cnt; i++)
      printf("%d %d %d %d\n", ans[i][0], ans[i][1], ans[i][2], ans[i][3]);
  }
  return 0;
}
