#include <bits/stdc++.h>
using namespace std;
int c[100];
int a[100][100];
vector<vector<int> > v;
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &c[i]);
  }
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (c[i]); ++j) scanf("%d", &a[i][j]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < c[i]; ++j) {
      int mn = a[i][j];
      int mini = i, minj = j;
      for (int jj = j + 1; jj < c[i]; ++jj)
        if (a[i][jj] < mn) {
          mn = a[i][jj], mini = i, minj = jj;
        }
      for (int ii = i + 1; ii < n; ++ii)
        for (int jj = 0; jj < c[ii]; ++jj)
          if (a[ii][jj] < mn) {
            mn = a[ii][jj], mini = ii, minj = jj;
          }
      if (mn == a[i][j]) continue;
      swap(a[i][j], a[mini][minj]);
      v.push_back({i, j, mini, minj});
    }
  printf("%d\n", v.size());
  for (int i = 0; i < (v.size()); ++i) {
    printf("%d", v[i][0] + 1);
    for (int j = (1); j <= (3); ++j) printf(" %d", v[i][j] + 1);
    cout << endl;
  }
}
