#include <bits/stdc++.h>
using namespace std;
pair<int, int> Mp[10000];
int n, s, ss;
int c[100];
int a[100][100];
int rl[5][10000];
int main() {
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    cin >> c[i];
    s += c[i];
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (c[i]); j++) {
      cin >> a[i][j];
      Mp[a[i][j]] = make_pair(i, j);
    }
  int Count = 0;
  int ss = s;
  for (int i = n; i >= 1; i--) {
    ss = ss - c[i] + 1;
    for (int k = (1); k <= (c[i]); k++) {
      if (a[i][k] == ss) {
        ss++;
        continue;
      }
      rl[1][++Count] = i;
      rl[2][Count] = k;
      rl[3][Count] = Mp[ss].first;
      rl[4][Count] = Mp[ss].second;
      int t = a[i][k];
      swap(a[i][k], a[Mp[ss].first][Mp[ss].second]);
      swap(Mp[t], Mp[ss]);
      ss++;
    }
    ss = ss - c[i] - 1;
  }
  cout << Count << endl;
  for (int i = (1); i <= (Count); i++)
    printf("%d %d %d %d\n", rl[1][i], rl[2][i], rl[3][i], rl[4][i]);
  return 0;
}
