#include <bits/stdc++.h>
using namespace std;
long c[100];
long a[100][100];
long dd[100][100];
long x[10000], y[10000], p[10000], q[10000];
long n, cnt;
int main() {
  long i, j, ii, jj, mint, luui, luuj, tmp;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> c[i];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) cin >> a[i][j];
  cnt = 0;
  memset(dd, 0, sizeof(dd));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= c[i]; j++) {
      mint = a[i][j];
      dd[i][j] = 1;
      for (ii = 1; ii <= n; ii++)
        for (jj = 1; jj <= c[ii]; jj++)
          if (dd[ii][jj] == 0)
            if (a[ii][jj] <= mint) {
              mint = a[ii][jj];
              luui = ii;
              luuj = jj;
            }
      if (mint < a[i][j]) {
        cnt++;
        x[cnt] = i;
        y[cnt] = j;
        p[cnt] = luui;
        q[cnt] = luuj;
        tmp = a[i][j];
        a[i][j] = a[luui][luuj];
        a[luui][luuj] = tmp;
      }
    }
  }
  cout << cnt << endl;
  for (i = 1; i <= cnt; i++)
    cout << x[i] << " " << y[i] << " " << p[i] << " " << q[i] << endl;
  return 0;
}
