#include <bits/stdc++.h>
using namespace std;
struct PLACE {
  int x;
  int h, l;
} p[60000];
int n, d[100];
bool cmp(PLACE a, PLACE b) { return a.x < b.x; }
bool vis[100000];
int a[100][100], before[100][100], ans1[10000], ans2[10000], ans3[10000],
    ans4[10000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  int s = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= d[i]; j++) {
      s++;
      cin >> p[s].x;
      before[i][j] = p[s].x;
      p[s].h = i;
      p[s].l = j;
    }
  if (s == 1) {
    cout << 0 << endl;
    return 0;
  }
  sort(p + 1, p + 1 + s, cmp);
  for (int i = 1; i <= n; i++) {
    before[p[i].h][p[i].l] = i;
  }
  int u = 0;
  s = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= d[i]; j++) {
      u++;
      int y = p[u].h, x = p[u].l, w = before[i][j];
      p[before[i][j]].h = p[u].h;
      p[before[i][j]].l = p[u].l;
      p[u].h = i, p[u].l = j;
      before[i][j] = u;
      before[y][x] = w;
      if (y != i || x != j) {
        s++;
        ans1[s] = y;
        ans2[s] = x;
        ans3[s] = i;
        ans4[s] = j;
      }
    }
  }
  cout << s << endl;
  for (int i = 1; i <= s; i++) {
    cout << ans1[i] << " " << ans2[i] << " " << ans3[i] << " " << ans4[i]
         << endl;
  }
  return 0;
}
