#include <bits/stdc++.h>
using namespace std;
int r[1005], k[1005], x[1005], y[1005], a[1005], b[1005], c[1005], d[1005];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> r[i], a[i] = i, c[i] = i;
  for (int i = 1; i <= n; i++) cin >> k[i], b[i] = i, d[i] = i;
  for (int i = 1; i <= n; i++) {
    x[r[i]] = i;
    y[k[i]] = i;
  }
  vector<pair<int, int>> ans;
  for (int i = 1; i <= n; i++) {
    if (x[i] == a[i] && y[i] == b[i]) continue;
    ans.push_back({c[x[i]], i}), ans.push_back({i, d[y[i]]});
    int t1 = c[x[i]], t2 = d[y[i]];
    swap(c[a[c[x[i]]]], c[a[i]]);
    swap(d[b[i]], d[b[d[y[i]]]]);
    swap(a[i], a[t1]);
    swap(b[i], b[t2]);
  }
  cout << ans.size() / 2 << '\n';
  for (int i = 0; i < ans.size(); i += 2) {
    cout << ans[i].first << ' ' << ans[i].second << ' ' << ans[i + 1].first
         << ' ' << ans[i + 1].second << '\n';
  }
  return 0;
}
