#include <bits/stdc++.h>
using namespace std;
int main() {
  int num[60][60], n, c[60], s, arr[3600], res[3600][4];
  while (cin >> n) {
    map<int, int> mapx, mapy;
    s = 0;
    int k = 0;
    for (int i = 1; i <= n; i++) {
      scanf(" %d", &c[i]);
      s += c[i];
    }
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= c[i]; j++) {
        scanf(" %d", &num[i][j]);
        mapx[num[i][j]] = i;
        mapy[num[i][j]] = j;
        arr[k++] = num[i][j];
      }
    sort(arr, arr + k);
    int m = 0;
    k = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= c[i]; j++) {
        if (num[i][j] == arr[k]) {
          k++;
          continue;
        }
        int temp;
        temp = num[i][j];
        int cordx = mapx[arr[k]], cordy = mapy[arr[k]];
        num[i][j] = num[cordx][cordy];
        num[cordx][cordy] = temp;
        mapx[num[i][j]] = i;
        mapy[num[i][j]] = j;
        mapx[num[cordx][cordy]] = cordx;
        mapy[num[cordx][cordy]] = cordy;
        res[m][0] = i;
        res[m][1] = j;
        res[m][2] = cordx;
        res[m][3] = cordy;
        m++;
        k++;
      }
    }
    cout << m << endl;
    for (int i = 0; i < m; i++) {
      bool flag = false;
      for (int j = 0; j < 4; j++) {
        if (flag) cout << " " << res[i][j];
        if (!flag) {
          cout << res[i][j];
          flag = true;
        }
      }
      cout << endl;
    }
  }
  return 0;
}
