#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 6;
int n, a[N], b[N], pa[N], push_back[N];
vector<pair<pair<int, int>, pair<int, int> > > ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), push_back[b[i]] = i;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), pa[a[i]] = i;
  for (int i = 1; i < n; i++) {
    if (a[i] == i && b[i] == i) continue;
    ans.push_back(make_pair(make_pair(i, pa[i]), make_pair(push_back[i], i)));
    a[pa[i]] = a[i], b[push_back[i]] = b[i];
    pa[a[pa[i]]] = pa[i], push_back[b[push_back[i]]] = push_back[i];
  }
  cout << ans.size() << endl;
  for (unsigned int i = 0; i < ans.size(); i++)
    printf("%d %d %d %d\n", ans[i].first.first, ans[i].first.second,
           ans[i].second.first, ans[i].second.second);
  return 0;
}
