#include <bits/stdc++.h>
using namespace std;
int buf_a;
inline int in() {
  scanf("%d", &buf_a);
  return buf_a;
}
void readf(string s) {
  string i = s + ".in";
  string o = s + ".out";
  freopen(i.c_str(), "r", stdin);
  freopen(o.c_str(), "w", stdout);
}
const int INF = ~(1 << 31);
const long long LINF = ~(1ll << 63);
int main() {
  int n = in();
  vector<pair<pair<int, int>, pair<int, int> > > res;
  vector<int> s;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    s.push_back(in());
    sum += s[s.size() - 1];
  }
  vector<pair<int, int> > a(sum);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < s[i]; ++j) {
      int b = in() - 1;
      a[b] = make_pair(i, j);
    }
  }
  int t = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < s[i]; ++j, ++t) {
      if (a[t] == make_pair(i, j)) continue;
      res.push_back(make_pair(make_pair(i, j), a[t]));
      for (int k = 0; k < a.size(); ++k) {
        if (a[k] == make_pair(i, j)) {
          swap(a[k], a[t]);
          break;
        }
      }
    }
  }
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) {
    printf("%d %d %d %d\n", res[i].first.first + 1, res[i].first.second + 1,
           res[i].second.first + 1, res[i].second.second + 1);
  }
  return 0;
}
