#include <bits/stdc++.h>
using namespace std;
const int nsz = 1050;
int n;
struct ta {
  int v[4];
} ans[nsz];
int pa = 0;
int ne1[nsz], pr1[nsz], ne2[nsz], pr2[nsz];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (register int i = (1); i <= (n); ++i) cin >> ne1[i], pr1[ne1[i]] = i;
  for (register int i = (1); i <= (n); ++i) cin >> ne2[i], pr2[ne2[i]] = i;
  for (register int i = (1); i <= (n); ++i) {
    int x = pr1[i], y = pr2[i];
    ne1[pr1[i]] = ne1[i], pr1[ne1[i]] = pr1[i];
    ne2[pr2[i]] = ne2[i], pr2[ne2[i]] = pr2[i];
    if (x == i && y == i) continue;
    ans[++pa] = (ta){{i, y, x, i}};
  }
  cout << pa << '\n';
  for (register int i = (1); i <= (pa); ++i)
    cout << ans[i].v[0] << ' ' << ans[i].v[1] << ' ' << ans[i].v[2] << ' '
         << ans[i].v[3] << '\n';
  return 0;
}
