#include <bits/stdc++.h>
namespace my_std {
using namespace std;
inline int read() {
  register int ans = 0, f = 1;
  register char c = getchar();
  while (!isdigit(c)) f ^= (c == '-'), c = getchar();
  for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
  return f ? ans : -ans;
}
template <typename _Tp>
inline int chkmin(_Tp &x, _Tp y) {
  return x > y ? x = y, 1 : 0;
}
template <typename _Tp>
inline int chkmax(_Tp &x, _Tp y) {
  return x < y ? x = y, 1 : 0;
}
const int mod = 998244353, N = 1010;
inline void inc(int &x, const int &y) {
  x += y;
  if (x >= mod) x -= mod;
}
inline int ksm(int x, long long y) {
  int res = 1;
  for (; y; y >>= 1, x = 1ll * x * x % mod)
    if (y & 1) res = 1ll * res * x % mod;
  return res;
}
template <typename _Tp>
inline _Tp gcd(_Tp x, _Tp y) {
  return y ? gcd(y, x % y) : x;
}
}  // namespace my_std
using namespace my_std;
int n, r[N], c[N], idr[N], idc[N];
vector<pair<pair<int, int>, pair<int, int> > > ans;
int main() {
  n = read();
  for (register int i = (1), ed_i = (n); i <= ed_i; ++i) idr[r[i] = read()] = i;
  for (register int i = (1), ed_i = (n); i <= ed_i; ++i) idc[c[i] = read()] = i;
  for (register int i = (1), ed_i = (n); i <= ed_i; ++i) {
    if (idr[i] == i && idc[i] == i) continue;
    ans.push_back(make_pair(make_pair(i, idc[i]), make_pair(idr[i], i)));
    r[idr[i]] = r[i], idr[r[i]] = idr[i];
    idr[i] = i, r[i] = i;
    c[idc[i]] = c[i], idc[c[i]] = idc[i];
    idc[i] = i, c[i] = i;
  }
  printf("%d\n", (int)ans.size());
  for (auto &i : ans) {
    printf("%d %d %d %d\n", i.first.first, i.first.second, i.second.first,
           i.second.second);
  }
  return 0;
}
