#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
int c[MAXN];
int t[MAXN][MAXN];
int n;
vector<int> res;
void readData() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); ++i) {
    scanf("%d", c + i);
  }
  for (int i = 1; i <= (n); ++i) {
    for (int j = 1; j <= (c[i]); ++j) {
      scanf("%d", &(t[i][j]));
    }
  }
}
int main() {
  readData();
  int maw, mak;
  for (int i = n; i >= (1); --i) {
    for (int j = c[i]; j >= (1); --j) {
      maw = i;
      mak = j;
      for (int x = n; x >= (1); --x) {
        for (int y = c[x]; y >= (1); --y) {
          if ((x == i && y < j) || x < i) {
            if (t[x][y] > t[maw][mak]) {
              maw = x;
              mak = y;
            }
          }
        }
      }
      if (maw != i || mak != j) {
        swap(t[i][j], t[maw][mak]);
        res.push_back(i);
        res.push_back(j);
        res.push_back(maw);
        res.push_back(mak);
      }
    }
  }
  printf("%d\n", (int)res.size() / 4);
  int i = 0;
  for (int xx = 0; xx < (res.size() / 4); ++xx) {
    for (int yy = 0; yy < (4); ++yy) {
      printf("%d ", res[i]);
      i++;
    }
    printf("\n");
  }
}
