#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int r[N], c[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> r[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
  }
  vector<pair<int, int> > m1, m2;
  for (int k = 1; k <= n; ++k) {
    int x = r[k], y = c[k];
    while (x > k) {
      x = r[x];
    }
    while (y > k) {
      y = c[y];
    }
    if (x != k or y != k) {
      m1.push_back({x, k});
      m2.push_back({k, y});
    }
  }
  int sz = m1.size();
  cout << sz << '\n';
  for (int i = 0; i < sz; ++i) {
    cout << m1[i].first << ' ' << m1[i].second << ' ';
    cout << m2[i].first << ' ' << m2[i].second << '\n';
  }
}
