#include <bits/stdc++.h>
using namespace std;
const int N = (int)50;
int n, c[N], a[N][N];
vector<pair<int, int> > _a, _b;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < c[i]; j++) cin >> a[i][j];
  int num = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < c[i]; j++) {
      num++;
      if (a[i][j] == num) continue;
      int x = 0, y = 0;
      bool flag = true;
      for (x = 0; x < n && flag; x++)
        for (y = 0; y < c[x] && flag; y++)
          if (a[x][y] == num) flag = false;
      swap(a[i][j], a[x - 1][y - 1]);
      _a.push_back(make_pair(i + 1, j + 1));
      _b.push_back(make_pair(x, y));
    }
  cout << (int)(_a).size() << endl;
  for (int i = 0; i < (int)(_a).size(); i++)
    cout << _a[i].first << ' ' << _a[i].second << ' ' << _b[i].first << ' '
         << _b[i].second << endl;
  return 0;
}
