#include <bits/stdc++.h>
using namespace std;
int ar[60][60], d;
int main() {
  int n, a, j, t = 0, i, ii, jj;
  vector<int> v, v2;
  cin >> n;
  for (int i = 0; i < n; i = i + 1) {
    cin >> a;
    t += a;
    v.push_back(a);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < v[i]; j++) {
      cin >> ar[i][j];
    }
  }
  int q = 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < v[i]; j++) {
      if (ar[i][j] != q) {
        int flag = 0;
        for (ii = i; ii < n; ii++) {
          for (jj = 0; jj < v[ii]; jj++) {
            if (ar[ii][jj] == q) {
              flag = 1;
              swap(ar[ii][jj], ar[i][j]);
              d++;
              v2.push_back(i + 1);
              v2.push_back(j + 1);
              v2.push_back(ii + 1);
              v2.push_back(jj + 1);
              break;
            }
          }
          if (flag == 1) break;
        }
      }
      q++;
    }
  }
  cout << d << "\n";
  for (int i = 0; i < v2.size(); i++) {
    cout << v2[i] << " ";
    if (i % 4 == 3) cout << "\n";
  }
}
