#include <bits/stdc++.h>
using namespace std;
struct point {
  int x;
  int y;
};
struct flask {
  int a1;
  int a2;
  int a3;
  int a4;
  flask() {}
};
int main() {
  vector<flask> res = vector<flask>();
  int n;
  cin >> n;
  int c[n];
  for (int i = (0); i < (n); i++) cin >> c[i];
  int s = 0;
  for (int i = (0); i < (n); i++) s += c[i];
  int data[50][50];
  memset(data, 0, sizeof(int) * 50 * 50);
  map<int, point> index = map<int, point>();
  for (int i = (0); i < (n); i++) {
    for (int j = (0); j < (c[i]); j++) {
      cin >> data[i][j];
      index[data[i][j]].x = i;
      index[data[i][j]].y = j;
    }
  }
  point pos;
  pos.x = 0;
  pos.y = 0;
  for (int i = (1); i < (s + 1); i++) {
    int old_value = data[pos.x][pos.y];
    point current = index[i];
    if (current.x != pos.x || current.y != pos.y) {
      data[pos.x][pos.y] = i;
      data[current.x][current.y] = old_value;
      index[old_value].x = index[i].x;
      index[old_value].y = index[i].y;
      index[i].x = pos.x;
      index[i].y = pos.y;
      res.push_back(flask());
      int cr = res.size() - 1;
      res[cr].a1 = pos.x + 1;
      res[cr].a2 = pos.y + 1;
      res[cr].a3 = current.x + 1;
      res[cr].a4 = current.y + 1;
    }
    if ((pos.x + 1 < n) && data[pos.x + 1][pos.y] != 0)
      pos.x++;
    else {
      pos.x = 0;
      pos.y++;
    }
  }
  cout << res.size() << endl;
  for (int i = (0); i < (res.size()); i++)
    cout << res[i].a1 << " " << res[i].a2 << " " << res[i].a3 << " "
         << res[i].a4 << endl;
  return 0;
}
