#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int a[MAXN][MAXN], i, j, n, k, l, m, s, c[MAXN], sum[MAXN], now = 0, anss = 0,
                                                            ans[MAXN * MAXN][4];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) scanf("%d", &a[i][j]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= c[i]; j++) {
      ++now;
      if (a[i][j] != now) {
        for (k = i; k <= n; k++)
          for (l = ((k == i) ? j + 1 : 1); l <= c[k]; l++)
            if (a[k][l] == now) {
              ++anss;
              ans[anss][0] = i;
              ans[anss][1] = j;
              ans[anss][2] = k;
              ans[anss][3] = l;
              swap(a[i][j], a[k][l]);
            }
      }
    }
  printf("%d\n", anss);
  for (i = 1; i <= anss; i++)
    printf("%d %d %d %d\n", ans[i][0], ans[i][1], ans[i][2], ans[i][3]);
  return 0;
}
