#include <bits/stdc++.h>
int p[(50) + 1][(50) + 1], q[(50) * (50) + 1];
int c[(50) + 1];
int ans[(50) * (50) + 1][4];
int main() {
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) scanf("%d", c + i);
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= c[i]; ++j) {
      scanf("%d", *(p + i) + j);
      q[p[i][j]] = 51 * i + j;
    }
  int count(1), poi(0);
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= c[i]; ++j) {
      if (p[i][j] != count) {
        int x = q[count] / 51, y = q[count] % 51;
        ans[poi][0] = i, ans[poi][1] = j, ans[poi][2] = x, ans[poi][3] = y,
        ++poi;
        p[x][y] = p[i][j];
        q[p[i][j]] = q[count];
      }
      ++count;
    }
  printf("%d\n", poi);
  for (int i = 0; i < poi; ++i)
    printf("%d %d %d %d\n", ans[i][0], ans[i][1], ans[i][2], ans[i][3]);
  return 0;
}
