#include <bits/stdc++.h>
using namespace std;
const int maxn = 70;
int arrey[maxn][maxn];
int c[maxn];
vector<pair<pair<int, int>, pair<int, int> > > ans;
int main() {
  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 >> arrey[i][j];
  int res = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      int a = -1, b = -1, mx = arrey[i][j];
      for (int p = i; p < n; p++) {
        int l = 0;
        if (p == i) l = j + 1;
        for (int q = l; q < c[p]; q++) {
          if (arrey[p][q] < mx) {
            mx = arrey[p][q];
            a = p;
            b = q;
          }
        }
      }
      if (a > -1) {
        res++;
        swap(arrey[i][j], arrey[a][b]);
        ans.push_back(
            make_pair(make_pair(i + 1, j + 1), make_pair(a + 1, b + 1)));
      }
    }
  }
  cout << res << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first.first << " " << ans[i].first.second << " "
         << ans[i].second.first << " " << ans[i].second.second << endl;
}
