#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 2333;
int n;
struct node {
  int p[N], q[N];
  void init() {
    for (register int i = (1); i <= (n); i++) read(p[i]), q[p[i]] = i;
  }
  void f(int x, int y) {
    if (x != y) {
      swap(p[x], p[y]);
      swap(q[p[x]], q[p[y]]);
    }
  }
} x, y;
struct Ans {
  int a, b, c, d;
} ans[N];
int sz;
int main() {
  read(n);
  x.init();
  y.init();
  for (register int i = (1); i <= (n); i++) {
    int a = x.q[i], b = y.q[i];
    if (a != i || b != i) ans[++sz] = (Ans){i, b, a, i};
    x.f(i, a);
    y.f(i, b);
  }
  printf("%d\n", sz);
  for (register int i = (1); i <= (sz); i++)
    printf("%d %d %d %d\n", ans[i].a, ans[i].b, ans[i].c, ans[i].d);
  return 0;
}
