#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); }
const int maxn = 1e6 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
long long gcd(long long x, long long y) {
  if (x < y) return gcd(y, x);
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long modexp(long long x, long long ex) {
  long long ans = 1ll;
  while (ex > 0) {
    if (ex & 1ll) ans = (ans * x) % mod;
    ex >>= 1ll;
    x = (x * x) % mod;
  }
  return ans;
}
int ci[maxn];
int c[maxn];
int ri[maxn];
int r[maxn];
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
  };
  int n;
  cin >> n;
  for (int j = 1; j <= n; j++) {
    cin >> r[j];
    ri[r[j]] = j;
  }
  for (int j = 1; j <= n; j++) {
    cin >> c[j];
    ci[c[j]] = j;
  }
  vector<pair<pair<int, int>, pair<int, int> > > ans;
  for (int j = n; j >= 1; j--) {
    if (r[j] == j && c[j] == j) {
      continue;
    }
    int cj = c[j], rj = r[j];
    ans.push_back({{j, cj}, {rj, j}});
    int x = ci[j];
    c[x] = cj;
    ci[cj] = x;
    x = ri[j];
    r[x] = rj;
    ri[rj] = x;
  }
  cout << ans.size() << "\n";
  for (pair<pair<int, int>, pair<int, int> > x : ans) {
    cout << x.first.first << " " << x.first.second << " " << x.second.first
         << " " << x.second.second << "\n";
  }
}
