#include <bits/stdc++.h>
using namespace std;
int data[100][100];
int c[100];
int n;
vector<int> vec;
int main() {
  int s = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &c[i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < c[i]; ++j) {
      scanf("%d", &data[i][j]);
      vec.push_back(data[i][j]);
      s++;
    }
  int tmp;
  sort(vec.begin(), vec.end());
  int it = 0;
  vector<vector<int> > swaps;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < c[i]; ++j) {
      for (int k = 0; k < n; ++k)
        for (int l = 0; l < c[k]; ++l)
          if (data[k][l] == vec[it]) {
            if (k != i || j != l) {
              vector<int> t;
              t.push_back(i);
              t.push_back(j);
              t.push_back(k);
              t.push_back(l);
              swaps.push_back(t);
              tmp = data[k][l];
              data[k][l] = data[i][j];
              data[i][j] = tmp;
            }
            l = c[k];
            k = n;
            it++;
          }
    }
  printf("%d\n", swaps.size());
  for (int i = 0; i < swaps.size(); ++i) {
    for (int j = 0; j < 4; ++j) printf("%d ", swaps[i][j] + 1);
    printf("\n");
  }
}
