#include <bits/stdc++.h>
using namespace std;
void test_case() {
  const int N = 55;
  int n, x, y, m = 0;
  cin >> n;
  int arr[N][N] = {0};
  map<int, pair<int, int>> pos;
  deque<int> ci, sally;
  vector<pair<pair<int, int>, pair<int, int>>> ans;
  for (int k = 0; k < n; ++k) {
    cin >> x;
    ci.push_back(x);
  }
  int k = 0;
  for (auto z : ci) {
    for (int j = 0; j < z; ++j) {
      cin >> arr[k][j];
      sally.push_back(arr[k][j]);
      pos[arr[k][j]] = {k, j};
    }
    k++;
  }
  sort(sally.begin(), sally.end());
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < ci.front(); ++j) {
      if (pos[sally.front()].first == i && pos[sally.front()].second == j)
        sally.pop_front();
      else {
        m++;
        ans.push_back(
            {{pos[sally.front()].first, pos[sally.front()].second}, {i, j}});
        pos[arr[i][j]] = {pos[sally.front()].first, pos[sally.front()].second};
        arr[pos[sally.front()].first][pos[sally.front()].second] = arr[i][j];
        sally.pop_front();
      }
    }
    ci.pop_front();
  }
  cout << m << endl;
  for (auto x : ans) {
    cout << x.first.first + 1 << " " << x.first.second + 1 << " "
         << x.second.first + 1 << " " << x.second.second + 1 << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  while (t--) {
    test_case();
  }
  return 0;
}
