#include <bits/stdc++.h>
using namespace std;
int n, c[200], a[200][200], m;
pair<int, int> b[200 * 200];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    m += c[i];
  };
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++) {
      scanf("%d", &a[i][j]);
      b[a[i][j]] = make_pair(i, j);
    };
  vector<pair<pair<int, int>, pair<int, int> > > answer;
  for (int i = n; i >= 1; i--)
    for (int j = c[i]; j >= 1; j--) {
      if (!(i == b[m].first && j == b[m].second))
        answer.push_back(
            make_pair(make_pair(i, j), make_pair(b[m].first, b[m].second)));
      b[a[i][j]] = make_pair(b[m].first, b[m].second);
      swap(a[i][j], a[b[m].first][b[m].second]);
      --m;
    };
  printf("%d\n", answer.size());
  for (int i = 0; i < answer.size(); i++)
    printf("%d %d %d %d\n", answer[i].first.first, answer[i].first.second,
           answer[i].second.first, answer[i].second.second);
  return 0;
}
