#include <bits/stdc++.h>
using namespace std;
int c[110][110], b[110][110];
int n, m;
struct P {
  int a, b, c, d;
} p[100000];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i < n + 1; i++) scanf("%d", &c[i][0]);
    for (int i = 1; i < n + 1; i++)
      for (int j = 1; j < c[i][0] + 1; j++) scanf("%d", &c[i][j]);
    memcpy(b, c, sizeof(b));
    m = 0;
    int cnt = 0;
    for (int i = 1; i < n + 1; i++)
      for (int j = 1; j < c[i][0] + 1; j++) {
        cnt++;
        if (c[i][j] == cnt) continue;
        bool flag = 0;
        for (int k = 1; k < n + 1; k++)
          for (int l = 1; l < c[k][0] + 1; l++)
            if (c[k][l] == cnt) {
              p[m++] = (P){i, j, k, l};
              swap(c[i][j], c[k][l]);
              break;
            }
      }
    cout << m << endl;
    for (int i = 0; i < m; i++)
      cout << p[i].a << " " << p[i].b << " " << p[i].c << " " << p[i].d << endl;
  }
  return 0;
}
