#include <bits/stdc++.h>
using namespace std;
inline double sqr(double x) { return x * x; }
#pragma comment(linker, "/STACK:16777216")
int n, s[50], k, a[50][50];
pair<int, int> v[50 * 50 + 1];
vector<pair<pair<int, int>, pair<int, int> > > r;
int main() {
  cin >> n;
  for (int i = int(0); i < int(n); ++i) cin >> s[i];
  for (int i = int(0); i < int(n); ++i)
    for (int j = int(0); j < int(s[i]); ++j) {
      cin >> k;
      a[i][j] = k;
      v[k] = make_pair(i, j);
    }
  int cnt = 0;
  for (int i = int(0); i < int(n); ++i)
    for (int j = int(0); j < int(s[i]); ++j) {
      cnt++;
      if (v[cnt] != make_pair(i, j)) {
        r.push_back(make_pair(make_pair(i, j), v[cnt]));
        v[a[i][j]] = v[cnt];
        a[v[cnt].first][v[cnt].second] = a[i][j];
      }
    }
  cout << r.size() << endl;
  for (int i = int(0); i < int(r.size()); ++i)
    cout << r[i].first.first + 1 << ' ' << r[i].first.second + 1 << ' '
         << r[i].second.first + 1 << ' ' << r[i].second.second + 1 << endl;
  return 0;
}
