#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 2;
int n, m;
struct Ans {
  int sx, sy, tx, ty;
} ans[MAXN];
int R[MAXN], C[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &R[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &C[i]);
  }
  for (int i = 1; i <= n; ++i) {
    int x = -1, y = -1;
    for (x = i; x <= n; ++x)
      if (R[x] == i) break;
    for (y = i; y <= n; ++y)
      if (C[y] == i) break;
    if (x == -1 || y == -1) return printf("-1\n"), 0;
    if (x == i && y == i) continue;
    ans[++m] = (Ans){x, i, i, y};
    R[x] = R[i];
    C[y] = C[i];
  }
  printf("%d\n", m);
  for (int i = 1; i <= m; ++i)
    printf("%d %d %d %d\n", ans[i].sx, ans[i].sy, ans[i].tx, ans[i].ty);
  return 0;
}
