#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > v(n);
  vector<vector<int> > answ(2501);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v[i].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    int x;
    for (int j = 0; j < v[i][0]; j++) {
      cin >> x;
      v[i].push_back(x);
    }
  }
  int s = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < v[i].size(); j++) {
      if (v[i][j] != s + j) {
        ans++;
        int h = 0;
        for (int k = 0; k < n; k++) {
          for (int l = 1; l < v[k].size(); l++) {
            if (v[k][l] == s + j) {
              answ[ans - 1].push_back(i + 1);
              answ[ans - 1].push_back(j);
              answ[ans - 1].push_back(k + 1);
              answ[ans - 1].push_back(l);
              int x;
              x = v[i][j];
              v[i][j] = v[k][l];
              v[k][l] = x;
            }
          }
        }
      }
    }
    s += v[i][0];
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << answ[i][0] << " " << answ[i][1] << " " << answ[i][2] << " "
         << answ[i][3] << endl;
  }
  return 0;
}
