#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char c;
  for (c = getchar(); !isdigit(c); c = getchar())
    ;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
}
const int N = 2005, P = 998244353;
int mul(int a, int b) { return 1ll * a * b % P; }
int add(int a, int b) {
  a += b;
  return a >= P ? a - P : a;
}
int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + P : a;
}
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
void upd(int &a, int b) { a = add(a, b); }
int powMod(int x, int k) {
  int res = 1;
  for (; k; k >>= 1, x = mul(x, x))
    if (k & 1) res = mul(res, x);
  return res;
}
int inv(int x) { return powMod(x, P - 2); }
int frac(int a, int b) { return mul(a, inv(b)); }
int n, a[N], afr[N], b[N], bfr[N];
char str[N * 20];
int strP = 0, len;
void sol(int top) {
  if (top == n) return;
  int xa = afr[top], xb = bfr[top];
  if (a[top] == top && b[top] == top) {
    sol(top + 1);
    return;
  }
  ++len, strP += sprintf(str + strP, "%d %d %d %d\n", xa, top, top, xb);
  a[xa] = a[top];
  afr[a[xa]] = xa;
  b[xb] = b[top];
  bfr[b[xb]] = xb;
  sol(top + 1);
}
int main(int argc, char *argv[]) {
  read(n);
  for (int i = 1; i <= (n); ++i) read(a[i]);
  for (int i = 1; i <= (n); ++i) afr[a[i]] = i;
  for (int i = 1; i <= (n); ++i) read(b[i]);
  for (int i = 1; i <= (n); ++i) bfr[b[i]] = i;
  sol(1);
  printf("%d\n%s", len, str);
  return 0;
}
