#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  vector<int> vec;
  int n;
  cin >> n;
  int c[50];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  int arr[50][50];
  int arr1[50][50];
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < c[i]; k++) {
      cin >> arr[i][k];
    }
  }
  int l = 1;
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < c[i]; k++) {
      arr1[i][k] = l;
      l++;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < c[i]; k++) {
      if (arr[i][k] != arr1[i][k]) {
        vec.push_back(i + 1);
        vec.push_back(k + 1);
        for (int j = 0; j < n; j++) {
          for (int q = 0; q < c[i]; q++) {
            if (arr[j][q] == arr1[i][k]) {
              vec.push_back(j + 1);
              vec.push_back(q + 1);
              arr[j][q] = arr[i][k];
            }
          }
        }
        arr[i][k] = arr1[i][k];
        ans++;
      }
    }
  }
  cout << ans << endl;
  for (int i = 0; i < vec.size(); i++) {
    cout << vec[i] << " ";
    if ((i + 1) % 4 == 0) cout << endl;
  }
}
