#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[52][52];
  int pos[2500][2];
  int n;
  int c[52];
  scanf("%d", &n);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
    sum += c[i];
  }
  int ans[sum + 1][4];
  int count = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c[i]; j++) cin >> a[i][j];
  int x = 0;
  int f = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= c[i]; j++) {
      if (a[i][j] != (x + j)) {
        f = 0;
        for (int k = j + 1; k <= c[i]; k++)
          if (a[i][k] == (x + j)) {
            ans[count][0] = i;
            ans[count][1] = j;
            ans[count][2] = i;
            ans[count][3] = k;
            count++;
            int temp = a[i][j];
            a[i][j] = a[i][k];
            a[i][k] = temp;
            f = 1;
          }
        if (f == 1)
          continue;
        else {
          for (int k = i + 1; k <= n; k++) {
            for (int l = 1; l <= c[k]; l++) {
              if (a[k][l] == (x + j)) {
                ans[count][0] = i;
                ans[count][1] = j;
                ans[count][2] = k;
                ans[count][3] = l;
                count++;
                int temp = a[i][j];
                a[i][j] = a[k][l];
                a[k][l] = temp;
              }
            }
          }
        }
      }
    }
    x += c[i];
  }
  cout << count << endl;
  for (int i = 0; i < count; i++)
    printf("%d %d %d %d\n", ans[i][0], ans[i][1], ans[i][2], ans[i][3]);
  return 0;
}
