#include <bits/stdc++.h>
using namespace std;
int len[55];
int n;
struct node {
  int x, y, s;
} arr[55 * 55];
int ans[55 * 55][2];
int main() {
  int i, j, tmp, k;
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; i++) scanf("%d", &len[i]);
    k = 0;
    for (i = 1; i <= n; i++)
      for (j = 1; j <= len[i]; j++) {
        scanf("%d", &tmp);
        arr[k].x = i;
        arr[k].y = j;
        arr[k++].s = tmp;
      }
    int mi, t, m = 0;
    for (i = 0; i < k - 1; i++) {
      mi = arr[i].s;
      t = i;
      for (j = i + 1; j < k; j++)
        if (arr[j].s < mi) {
          mi = arr[j].s;
          t = j;
        }
      if (t != i) {
        ans[m][0] = i;
        ans[m++][1] = t;
        swap(arr[i].s, arr[t].s);
      }
    }
    printf("%d\n", m);
    for (i = 0; i < m; i++)
      printf("%d %d %d %d\n", arr[ans[i][0]].x, arr[ans[i][0]].y,
             arr[ans[i][1]].x, arr[ans[i][1]].y);
  }
  return 0;
}
