#include <bits/stdc++.h>
using namespace std;
int arr[100][100];
int row[100];
vector<pair<pair<int, int>, pair<int, int> > > v;
int pos[30000][2];
int main() {
  int n;
  int sum = 0;
  while (scanf(" %d", &n) == 1) {
    v.clear();
    sum = 0;
    for (int i = 1; i <= n; i++) scanf(" %d", &row[i]);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= row[i]; j++) {
        scanf(" %d", &arr[i][j]);
        pos[arr[i][j]][0] = i;
        pos[arr[i][j]][1] = j;
      }
      sum += row[i];
    }
    int cnt = 1;
    int swcnt = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= row[i]; j++) {
        if (arr[i][j] != cnt) {
          swcnt++;
          int r = pos[cnt][0];
          int c = pos[cnt][1];
          int val = arr[i][j];
          arr[i][j] = cnt;
          arr[r][c] = val;
          pos[val][0] = r;
          pos[val][1] = c;
          pos[cnt][0] = i;
          pos[cnt][1] = j;
          v.push_back(make_pair(make_pair(i, j), make_pair(r, c)));
        }
        cnt++;
      }
    }
    printf("%d\n", swcnt);
    for (int i = 0; i < ((int)v.size()); i++)
      printf("%d %d %d %d\n", v[i].first.first, v[i].first.second,
             v[i].second.first, v[i].second.second);
  }
}
