#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int c[55], a[55][55];
vector<pair<int, pair<int, int> > > v(11111);
int ans1[11111][4];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  int tot = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      cin >> a[i][j];
    }
  }
  int K = 1, cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      if (a[i][j] == K) {
        K++;
        continue;
      }
      for (int k = 1; k <= n; k++) {
        for (int l = 1; l <= c[k]; l++) {
          if (a[k][l] == K) {
            ans1[cnt][0] = i;
            ans1[cnt][1] = j;
            ans1[cnt][2] = k;
            ans1[cnt][3] = l;
            cnt++;
            swap(a[i][j], a[k][l]);
            break;
          }
        }
      }
      K++;
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    for (int j = 0; j < 4; j++) cout << ans1[i][j] << " ";
    cout << endl;
  }
  return 0;
}
