#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
long long mpow(long long a, long long b) {
  if (b == 0) return 1;
  long long t1 = mpow(a, b / 2);
  t1 *= t1;
  t1 %= MOD;
  if (b % 2) t1 *= a;
  t1 %= MOD;
  return t1;
}
void solve() {
  long long n;
  cin >> n;
  long long p1[n], p2[n];
  long long a[n], b[n];
  for (long long i = 0; i < n; i++) {
    long long t;
    cin >> t;
    t--;
    p1[i] = t;
    a[t] = i;
  }
  for (long long i = 0; i < n; i++) {
    long long t;
    cin >> t;
    t--;
    p2[i] = t;
    b[t] = i;
  }
  vector<pair<long long, long long> > v;
  vector<long long> in;
  for (long long i = 0; i < n; i++) {
    long long r = a[i];
    long long c = b[i];
    if (r != i || c != i) {
      v.push_back(make_pair(r, c));
      in.push_back(i);
    }
    long long a1 = a[i], b1 = b[i];
    swap(a[i], a[p1[i]]);
    swap(b[i], b[p2[i]]);
    swap(p1[i], p1[a1]);
    swap(p2[i], p2[b1]);
  }
  cout << (long long)v.size() << "\n";
  for (long long i = 0; i < (long long)v.size(); i++) {
    cout << v[i].first + 1 << " " << in[i] + 1 << " " << in[i] + 1 << " "
         << v[i].second + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
