#include <bits/stdc++.h>
using namespace std;
template <class T>
bool checkMin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool checkMax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
string itostr(T x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
long long strtoll(string s) {
  stringstream ss(s);
  long long x;
  ss >> x;
  return x;
}
char buf[1024];
const double EPS = 1e-9;
const double PI = acos(-1);
const int INF = (int)(1e9);
const int MN = (int)55;
pair<int, int> at[MN * MN];
int n, m[MN], g[MN][MN], s;
vector<pair<pair<int, int>, pair<int, int> > > swaps;
int main() {
  scanf("%d", &n);
  s = 0;
  for (int i = 0; i < n; i++) scanf("%d", m + i), s += m[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m[i]; j++)
      scanf("%d", &g[i][j]), at[g[i][j]].first = i, at[g[i][j]].second = j;
  int c = 0, r = 0;
  for (int i = 1; i <= s; i++) {
    int &x = at[i].first, &y = at[i].second;
    int d = g[r][c];
    if (d != i) {
      swaps.push_back(pair<pair<int, int>, pair<int, int> >(
          pair<int, int>(r + 1, c + 1), pair<int, int>(x + 1, y + 1)));
      swap(g[r][c], g[x][y]);
      swap(x, at[d].first), swap(y, at[d].second);
    }
    c++;
    if (c >= m[r]) r++, c = 0;
  }
  printf("%d\n", swaps.size());
  for (int i = 0; i < swaps.size(); i++) {
    printf("%d %d %d %d\n", swaps[i].first.first, swaps[i].first.second,
           swaps[i].second.first, swaps[i].second.second);
  }
}
