#include <bits/stdc++.h>
using namespace std;
typedef struct Gate {
  int x, y;
  Gate(int x, int y) : x(x), y(y){};
} gate;
typedef struct Portal {
  gate a, b;
  Portal(gate a, gate b) : a(a), b(b){};
} portal;
int main() {
  int n;
  cin >> n;
  vector<int> r;
  r.resize(n);
  for (unsigned i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    r[a - 1] = i;
  }
  vector<int> c;
  c.resize(n);
  for (unsigned i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    c[a - 1] = i;
  }
  vector<portal> portals;
  for (int i = n; i > 1; --i) {
    auto it_r = find(r.begin(), r.end(), i);
    auto it_c = find(c.begin(), c.end(), i);
    int i_r = distance(r.begin(), it_r);
    int i_c = distance(c.begin(), it_c);
    if (i != i_r + 1 || i != i_c + 1) {
      portals.emplace_back(gate{i_c + 1, i}, gate{i, i_r + 1});
    }
    *it_r = r[i - 1];
    *it_c = c[i - 1];
  }
  if (r[0] != 1 || c[0] != 1) {
    cout << -1 << endl;
    return 0;
  }
  cout << portals.size() << endl;
  for (auto&& p : portals) {
    cout << p.a.y << ' ' << p.a.x << ' ' << p.b.y << ' ' << p.b.x << endl;
  }
}
