#include <bits/stdc++.h>
using namespace std;
int a[1111], b[1111], pos1[1111], pos2[1111], mmap1[1111], mmap2[1111],
    num1[1111], num2[1111];
pair<int, int> res1[1111], res2[1111];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++)
    scanf("%d", &a[i]), pos1[i] = i, mmap1[a[i]] = i, num1[i] = i;
  for (int i = 1; i < n + 1; i++)
    scanf("%d", &b[i]), pos2[i] = i, mmap2[b[i]] = i, num2[i] = i;
  int xsize = 0;
  for (int i = 1; i < n + 1; i++) {
    int k1 = pos1[mmap1[i]], k2 = pos2[mmap2[i]];
    if (k1 == i && k2 == i) continue;
    xsize++;
    res1[xsize] = {k1, i}, res2[xsize] = {i, k2};
    pos1[num1[i]] = k1, pos2[num2[i]] = k2, num1[k1] = num1[i],
    num2[k2] = num2[i];
  }
  printf("%d\n", xsize);
  for (int i = 1; i < xsize + 1; i++)
    printf("%d %d %d %d\n", res1[i].first, res1[i].second, res2[i].first,
           res2[i].second);
}
