#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 10, MOD = 1e9 + 7;
string s;
int mx;
int dp[100][100], a[100];
vector<int> v;
vector<pair<int, int> > pi;
struct node {
  int x, y;
} arr[M];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int r;
  cin >> r;
  for (int i = 1; i <= r; i++) cin >> a[i];
  for (int i = 1; i <= r; i++) {
    int c = a[i];
    for (int j = 1; j <= c; j++) {
      cin >> dp[i][j];
      v.push_back(dp[i][j]);
      arr[dp[i][j]].x = i;
      arr[dp[i][j]].y = j;
    }
  }
  sort(v.begin(), v.end());
  int k = 0;
  int cnt = 0;
  for (int i = 1; i <= r; i++) {
    int c = a[i];
    for (int j = 1; j <= c; j++) {
      int d = v[k];
      if (dp[i][j] != d) {
        int temp1, temp2;
        temp1 = arr[d].x;
        temp2 = arr[d].y;
        pi.push_back(make_pair(i, j));
        pi.push_back(make_pair(temp1, temp2));
        arr[d].x = i;
        arr[d].y = j;
        arr[dp[i][j]].x = temp1;
        arr[dp[i][j]].y = temp2;
        dp[temp1][temp2] = dp[i][j];
        cnt++;
      }
      k++;
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt * 2; i += 2) {
    int temp = pi[i].first;
    int temp1 = pi[i].second;
    int temp2 = pi[i + 1].first;
    int temp3 = pi[i + 1].second;
    cout << temp << " " << temp1 << " " << temp2 << " " << temp3 << "\n";
  }
  return 0;
}
