#include <bits/stdc++.h>
using namespace std;
int l[55];
int num[55][55];
map<int, pair<int, int> > x;
vector<pair<int, int> > a, b;
int main() {
  int ans, i, j, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &l[i]);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= l[i]; j++) {
      scanf("%d", &num[i][j]);
      x[num[i][j]] = make_pair(i, j);
    }
  }
  int q = 1;
  ans = 0;
  a.clear();
  b.clear();
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= l[i]; j++) {
      if (num[i][j] != q) {
        int we = num[i][j];
        ans++;
        a.push_back(make_pair(i, j));
        b.push_back(x[q]);
        swap(num[i][j], num[x[q].first][x[q].second]);
        x[we] = x[q];
      }
      q++;
    }
  }
  printf("%d\n", ans);
  for (i = 0; i < ans; i++) {
    printf("%d %d %d %d\n", a[i].first, a[i].second, b[i].first, b[i].second);
  }
  return 0;
}
