#include <bits/stdc++.h>
using namespace std;
int n, a[55][55], c[55], dd[55][55];
pair<int, pair<int, int> > p[55 * 55];
pair<pair<int, int>, pair<int, int> > res[55 * 55];
void solve() {
  int g = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++)
      p[++g] = pair<int, pair<int, int> >(a[i][j], pair<int, int>(i, j));
  sort(p + 1, p + g + 1);
  int l = 1;
  int m = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++) {
      int x = p[l].second.first, y = p[l].second.second;
      if (x != i || y != j) {
        res[++m] = pair<pair<int, int>, pair<int, int> >(pair<int, int>(i, j),
                                                         pair<int, int>(x, y));
        p[a[i][j]].second.first = x, p[a[i][j]].second.second = y;
        p[a[x][y]].second.first = i, p[a[x][y]].second.second = j;
        swap(a[i][j], a[x][y]);
      }
      l++;
    }
  printf("%d\n", m);
  for (int i = 1; i <= m; i++)
    printf("%d %d %d %d\n", res[i].first.first, res[i].first.second,
           res[i].second.first, res[i].second.second);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", c + i);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++) scanf("%d", &a[i][j]);
  solve();
  return 0;
}
