#include <bits/stdc++.h>
int c[70], d[70][70];
using namespace std;
int main() {
  vector<int> v;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      cin >> d[i][j];
    }
  }
  int t(1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      bool y = false;
      int m = j + 1;
      for (int k = i; k < n; k++) {
        for (; m < c[k]; m++) {
          if (d[k][m] == t) {
            swap(d[k][m], d[i][j]);
            v.push_back(i + 1);
            v.push_back(j + 1);
            v.push_back(k + 1);
            v.push_back(m + 1);
            y = 1;
            break;
          }
        }
        m = 0;
        if (y == 1) break;
      }
      t++;
    }
  }
  cout << v.size() / 4 << endl;
  for (int i = 0; i < v.size(); i++) {
    if (i % 4 == 0 && i != 0) cout << "\n";
    cout << v[i] << " ";
  }
  return 0;
}
