#include <bits/stdc++.h>
using namespace std;
const int LIM = 100, INF = 1e+9, hLEN = 7, dLEN = 4;
const double PI = 3.1415926535, EPS = 1e-7;
int PRIME[] = {1000000007, 1000002277, 1000000021, 1000000033,
               1000000801, 1000007773, 1000003601};
int BASE[] = {29, 31, 37, 41, 43, 47, 51};
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
template <class T>
inline T sqr(T a) {
  return a * a;
}
template <class T>
T gcd(T a, T b) {
  return a == 0 ? b : gcd(b % a, a);
}
template <class T>
T Abs(T a) {
  return a < 0 ? -a : a;
}
int n, a[LIM][LIM], m[LIM];
pair<int, int> p[LIM * LIM];
bool used[LIM * LIM];
set<pair<int, pair<int, int> > > s;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m[i]; j++) {
      cin >> a[i][j];
      s.insert(make_pair(a[i][j], make_pair(i, j)));
    }
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m[i]; j++) {
      set<pair<int, pair<int, int> > >::iterator it = s.begin();
      pair<int, pair<int, int> > minimal = *(it);
      s.erase(minimal);
      int u = a[i][j];
      if (minimal.second != make_pair(i, j)) {
        ans.push_back(make_pair(i, j));
        ans.push_back(minimal.second);
        swap(a[i][j], a[minimal.second.first][minimal.second.second]);
        if (s.find(make_pair(u, make_pair(i, j))) != s.end())
          s.erase(make_pair(u, make_pair(i, j)));
        s.insert(make_pair(
            u, make_pair(minimal.second.first, minimal.second.second)));
      }
    }
  }
  cout << ans.size() / 2 << endl;
  for (int i = 0; i < (int)ans.size(); i += 2) {
    cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << ' '
         << ans[i + 1].first + 1 << ' ' << ans[i + 1].second + 1 << endl;
  }
  return 0;
}
