#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010, mod = 1e9 + 7;
const long long inf = 1e18;
int a[maxn], b[maxn], cnt;
pair<int, int> p[maxn];
int pa[maxn], posa[maxn], pb[maxn], posb[maxn];
void Swap(int *arr, int *arrp, int i, int j) {
  arrp[arr[i]] = j;
  arrp[arr[j]] = i;
  swap(arr[i], arr[j]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[x] = i;
    pa[i] = pb[i] = posa[i] = posb[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    b[x] = i;
  }
  for (int i = 1; i <= n; i++) {
    p[i] = {posa[a[i]], posb[b[i]]};
    Swap(pa, posa, i, posa[a[i]]);
    Swap(pb, posb, i, posb[b[i]]);
    cnt += p[i].first != i || p[i].second != i;
  }
  cout << cnt << "\n";
  for (int i = 1; i <= n; i++) {
    if (p[i].first != i || p[i].second != i)
      cout << p[i].first << " " << i << " " << i << " " << p[i].second << "\n";
  }
  return 0;
}
