#include <bits/stdc++.h>
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
  std::cout << a << ' ';
  err(args...);
}
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 22;
const int N = 1005;
int n;
int wtx[N], wty[N], x[N], y[N], sty[N], stx[N], tox[N], toy[N];
vector<pair<int, int> > ve;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> stx[i];
    wtx[stx[i]] = i;
  }
  for (long long i = 1; i <= n; i++) {
    cin >> sty[i];
    wty[sty[i]] = i;
  }
  for (long long i = 1; i <= n; i++) x[i] = tox[i] = y[i] = toy[i] = i;
  for (long long i = 1; i <= n; i++) {
    if (x[i] == wtx[i] && y[i] == wty[i]) continue;
    int t1 = x[i], t2 = y[i];
    ve.push_back(make_pair(i, toy[wty[i]]));
    ve.push_back(make_pair(tox[wtx[i]], i));
    swap(x[i], x[tox[wtx[i]]]);
    swap(y[i], y[toy[wty[i]]]);
    swap(tox[wtx[i]], tox[t1]);
    swap(toy[wty[i]], toy[t2]);
  }
  cout << ve.size() / 2 << '\n';
  int cnt = 0;
  for (auto x : ve) {
    cnt++;
    cout << x.first << " " << x.second;
    if (cnt % 2 == 1)
      cout << " ";
    else
      cout << '\n';
  }
  return 0;
}
