#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
using namespace std;
vector<int> c;
int n, s, ans;
pair<int, int> t[3000];
int mat[55][55];
vector<pair<pair<int, int>, pair<int, int>>> a;
bool ok() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      if (i)
        if (mat[i][j] < mat[i - 1][j]) return false;
      if (j)
        if (mat[i][j] < mat[i][j - 1]) return false;
    }
  }
  return true;
}
void print() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      cout << mat[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    c.push_back(x);
    s += x;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      int x;
      cin >> x;
      t[x] = {i, j};
      mat[i][j] = x;
    }
  }
  while (!(ok())) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < c[i]; j++) {
        int x = mat[i][j];
        int pmin = INF;
        for (int k = 0; k < n; k++) {
          for (int l = 0; l < c[k]; l++) {
            if (k > i or (k == i and l > j)) {
              int y = mat[k][l];
              if (y < x) pmin = min(y, pmin);
            }
          }
        }
        if (pmin == INF) continue;
        int aux1 = t[pmin].first, aux2 = t[pmin].second;
        a.push_back({{i + 1, j + 1}, {t[pmin].first + 1, t[pmin].second + 1}});
        swap(mat[i][j], mat[t[pmin].first][t[pmin].second]);
        ans++;
        t[mat[t[pmin].first][t[pmin].second]] = {aux1, aux2};
        t[mat[i][j]] = {i, j};
      }
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < a.size(); i++) {
    cout << a[i].first.first << " " << a[i].first.second << " "
         << a[i].second.first << " " << a[i].second.second << "\n";
  }
  return 0;
}
