#include <bits/stdc++.h>
using namespace std;
int a[60][60], c[60];
int b[10000];
int ans[100000][4];
int main() {
  int n, m;
  int num, k, i, j, p, q;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> c[i];
  m = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) {
      cin >> a[i][j];
      b[m++] = a[i][j];
    }
  sort(b, b + m);
  k = 0;
  num = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) {
      if (a[i][j] != b[k])
        for (p = i; p <= n; p++)
          for (q = 1; q <= c[p]; q++)
            if ((p > i) || (q > j))
              if (a[p][q] == b[k]) {
                int t = a[i][j];
                a[i][j] = a[p][q];
                a[p][q] = t;
                ans[num][0] = i;
                ans[num][1] = j;
                ans[num][2] = p;
                ans[num++][3] = q;
              }
      k++;
    }
  cout << num << endl;
  for (i = 0; i < num; i++)
    cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " "
         << ans[i][3] << endl;
  return 0;
}
