#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c[100], t[100][100], x[3000], y[3000], s = 0, ans[3000][5];
  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 >> t[i][j];
      y[t[i][j]] = i;
      x[t[i][j]] = j;
    }
  int r = 0, a, b;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c[i]; j++) {
      r++;
      if (t[i][j] == r) continue;
      ans[s][0] = i + 1;
      ans[s][1] = j + 1;
      ans[s][2] = y[r] + 1;
      ans[s][3] = x[r] + 1;
      y[t[i][j]] = y[r];
      x[t[i][j]] = x[r];
      t[y[r]][x[r]] = t[i][j];
      t[i][j] = r;
      s++;
    }
  }
  cout << s << endl;
  for (int i = 0; i < s; i++) {
    for (int j = 0; j < 4; j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
