#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[100] = {};
  vector<int> a1, a2, a3, a4;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int matr[100][100];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i]; j++) {
      scanf("%d", &matr[i][j]);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i]; j++) {
      int mini = i, minj = j;
      for (int i2 = i; i2 < n; i2++) {
        int j2 = j + 1;
        if (i2 > i) j2 = 0;
        for (j2; j2 < a[i2]; j2++) {
          if (matr[i2][j2] < matr[mini][minj]) {
            mini = i2;
            minj = j2;
          }
        }
      }
      if (mini != i || minj != j) {
        a1.push_back(i);
        a2.push_back(j);
        a3.push_back(mini);
        a4.push_back(minj);
        swap(matr[i][j], matr[mini][minj]);
      }
    }
  }
  printf("%d", a1.size());
  for (int i = 0; i < a1.size(); i++) {
    printf("\n%d %d %d %d", a1[i] + 1, a2[i] + 1, a3[i] + 1, a4[i] + 1);
  }
  return 0;
}
