#include <bits/stdc++.h>
using namespace std;
int n, s, i, j, l;
int T[105][105], C[105], a;
typedef struct {
  int x, y, val;
} ceva;
vector<ceva> t;
vector<int> rez;
int pp;
ceva aux;
bool mysort(ceva a, ceva b) { return a.val < b.val; }
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);
      aux.x = i;
      aux.y = j;
      aux.val = a;
      t.push_back(aux);
      s++;
    }
  sort(t.begin(), t.end(), mysort);
  for (i = 0; i < s; i++) T[t[i].x][t[i].y] = i;
  l = s - 1;
  for (i = n; i >= 1; i--)
    for (j = C[i]; j > 0; j--) {
      if (T[i][j] != l) {
        rez.push_back(i);
        rez.push_back(j);
        rez.push_back(t[l].x);
        rez.push_back(t[l].y);
        pp++;
        t[T[i][j]].x = t[l].x;
        t[T[i][j]].y = t[l].y;
        T[t[l].x][t[l].y] = T[i][j];
      }
      l--;
    }
  printf("%d\n", pp);
  l = 0;
  for (i = 0; i < pp; i++) {
    printf("%d ", rez[l++]);
    printf("%d ", rez[l++]);
    printf("%d ", rez[l++]);
    printf("%d\n", rez[l++]);
  }
  return 0;
}
