#include <bits/stdc++.h>
using namespace std;
int n, a[2000], b[2000], ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = n; i; --i)
    if (a[i] != i || b[i] != i) {
      for (int j = 1; j < i; ++j)
        if (a[j] == i) a[j] = a[i];
      for (int j = 1; j < i; ++j)
        if (b[j] == i) b[j] = b[i];
      ++ans;
    }
  cout << ans << '\n';
  for (int i = 1; i <= n; ++i)
    if (a[i] != i || b[i] != i)
      cout << a[i] << ' ' << i << ' ' << i << ' ' << b[i] << '\n';
  return 0;
}
