#include <bits/stdc++.h>
using namespace std;
int len[50];
int a[50][50];
int n;
void Get(int num, int *x, int *y) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < len[i]; ++j) {
      if (a[i][j] == num) {
        *x = i;
        *y = j;
        return;
      }
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> len[i];
  }
  int s = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < len[i]; ++j) {
      cin >> a[i][j];
      ++s;
    }
  }
  vector<int> x1, x2, x3, x4;
  int k = 1, x, y;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < len[i]; ++j) {
      Get(k++, &x, &y);
      if (x == i && y == j) continue;
      x1.push_back(i + 1);
      x2.push_back(j + 1);
      x3.push_back(x + 1);
      x4.push_back(y + 1);
      swap(a[i][j], a[x][y]);
    }
  }
  printf("%d\n", x1.size());
  for (int i = 0; i < x1.size(); ++i) {
    printf("%d %d %d %d\n", x1[i], x2[i], x3[i], x4[i]);
  }
  return 0;
}
