#include <bits/stdc++.h>
using namespace std;
int n, a[55], b[55][55], s = 0, t = 0, np = 0;
pair<pair<int, int>, pair<int, int> > p[10005];
pair<int, int> d[10005];
map<pair<int, int>, int> m;
map<int, pair<int, int> > m2;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i], s += a[i];
  int cnt = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= a[i]; ++j) {
      int x;
      d[++cnt] = make_pair(i, j);
      cin >> m[d[cnt]];
      m2[m[d[cnt]]] = d[cnt];
    }
  np = 0;
  for (int i = 1; i < s; ++i)
    if (m[d[i]] != i) {
      int x = m[d[i]], y = i;
      ++np;
      p[np].first = m2[x], p[np].second = m2[y];
      swap(m[m2[x]], m[m2[y]]);
      swap(m2[x], m2[y]);
    }
  cout << np << endl;
  for (int i = 1; i <= np; ++i)
    cout << (p[i].first).first << " " << p[i].first.second << " "
         << p[i].second.first << " " << p[i].second.second << endl;
  return 0;
}
