#include <bits/stdc++.h>
using namespace std;
int n, s, i, j, x[2505], y[2505], u[2505], v[2505], p[2505], q[2505], m[55][55],
    a[55], g;
int main() {
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    for (i = 0; i < n; i++)
      for (j = 0; j < a[i]; j++)
        scanf("%d", &m[i][j]), p[m[i][j]] = i, q[m[i][j]] = j;
    for (s = i = 0; i < n; i++)
      for (j = 0; j < a[i]; j++) {
        s++;
        if (s != m[i][j])
          x[g] = i + 1, y[g] = j + 1, u[g] = p[s] + 1, v[g++] = q[s] + 1,
          m[p[s]][q[s]] = m[i][j], p[m[i][j]] = p[s], q[m[i][j]] = q[s];
      }
    printf("%d\n", g);
    for (i = 0; i < g; i++) printf("%d %d %d %d\n", x[i], y[i], u[i], v[i]);
  }
}
