#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct Data {
  int x, y, z, t;
};
int main() {
  int i, n, x;
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  vector<int> a(n + 1), b(n + 1), p(n + 1), q(n + 1);
  for (i = 1; i <= n; i++) {
    cin >> x;
    p[x] = i, a[i] = i;
  }
  for (i = 1; i <= n; i++) {
    cin >> x;
    q[x] = i, b[i] = i;
  }
  vector<int> pa(n + 1), pb(n + 1);
  for (i = 1; i <= n; i++) {
    pa[i] = pb[i] = i;
  }
  vector<Data> sol;
  for (i = 1; i < n; i++) {
    if (a[i] == p[i] && b[i] == q[i]) continue;
    sol.push_back({pa[p[i]], i, i, pb[q[i]]});
    int x = a[i], y = p[i];
    swap(a[i], a[pa[p[i]]]), swap(pa[x], pa[y]);
    x = b[i], y = q[i];
    swap(b[i], b[pb[q[i]]]), swap(pb[x], pb[y]);
  }
  cout << sol.size() << "\n";
  for (auto it : sol) {
    cout << it.x << " " << it.y << " " << it.z << " " << it.t << "\n";
  }
  return 0;
}
