#include <bits/stdc++.h>
using namespace std;
int n;
int c[51];
int a[51][51];
int res;
int num[3000][4];
int pos[3000][2];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      cin >> a[i][j];
      pos[a[i][j]][0] = i;
      pos[a[i][j]][1] = j;
    }
  }
  int row = 1;
  int col = 1;
  for (int i = 1; i <= 3000; i++)
    if (pos[i][0] != 0) {
      if (col > c[row]) {
        row++;
        col = 1;
      }
      if (row > n) {
        break;
      }
      if (a[row][col] != i) {
        int x = a[row][col];
        swap(a[row][col], a[pos[i][0]][pos[i][1]]);
        num[res][0] = row;
        num[res][1] = col;
        num[res][2] = pos[i][0];
        num[res][3] = pos[i][1];
        pos[x][0] = pos[i][0];
        pos[x][1] = pos[i][1];
        pos[i][0] = row;
        pos[i][1] = col;
        res++;
      }
      col++;
    }
  cout << res << endl;
  for (int i = 0; i < res; i++) {
    cout << num[i][0] << " " << num[i][1] << " " << num[i][2] << " "
         << num[i][3] << endl;
  }
  return 0;
}
