#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(int x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const int maxn = 1e6 + 10;
const int inf = 1e9;
const double eps = 1e-8;
const int mod = 1e9 + 7;
int a[maxn], b[maxn], p[maxn], q[maxn], n, tot;
struct data {
  int x1, y1, x2, y2;
} r[maxn];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++) read(b[i]);
  for (int i = 1; i <= n; i++) p[a[i]] = i, q[b[i]] = i;
  for (int i = 1; i <= n; i++) {
    if (a[i] == i && b[i] == i) continue;
    int x = p[i], y = q[i];
    r[++tot] = (data){x, i, i, y};
    p[a[i]] = x, q[b[i]] = y;
    a[x] = a[i], b[y] = b[i];
  }
  write(tot);
  for (int i = 1; i <= tot; i++)
    printf("%d %d %d %d\n", r[i].x1, r[i].y1, r[i].x2, r[i].y2);
  return 0;
}
