#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > grid(n);
  vector<int> s(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    grid[i].resize(s[i]);
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < s[i]; ++j) cin >> grid[i][j];
  int id = 1;
  vector<int> a, b, c, d;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < s[i]; ++j) {
      if (grid[i][j] != id) {
        for (int k = 0; k < n; ++k)
          for (int l = 0; l < s[k]; ++l) {
            if (grid[k][l] == id) {
              a.push_back(i + 1);
              b.push_back(j + 1);
              c.push_back(k + 1);
              d.push_back(l + 1);
              swap(grid[i][j], grid[k][l]);
              break;
            }
          }
      }
      id++;
    }
  }
  cout << a.size() << '\n';
  for (int i = 0; i < a.size(); ++i)
    cout << a[i] << ' ' << b[i] << ' ' << c[i] << ' ' << d[i] << '\n';
}
