#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<unsigned> data1(n), data2(n);
  std::vector<std::vector<unsigned>> res;
  for (unsigned i = 0; i < n; ++i) {
    unsigned a;
    std::cin >> a;
    if (a < n + 1) data1[a - 1] = i;
  }
  for (unsigned i = 0; i < n; ++i) {
    unsigned a;
    std::cin >> a;
    if (a < n + 1) data2[a - 1] = i;
  }
  for (unsigned i = 0; i < n; ++i) {
    if (data1[i] == i && data2[i] == i) continue;
    if (i == n - 1) {
      std::cout << -1 << std::endl;
      return 0;
    }
    res.push_back({data1[i], i, i, data2[i]});
    for (unsigned j = 0; j < n; ++j) {
      if (data1[j] == i) {
        std::swap(data1[j], data1[i]);
        break;
      }
    }
    for (unsigned j = 0; j < n; ++j) {
      if (data2[j] == i) {
        std::swap(data2[j], data2[i]);
        break;
      }
    }
  }
  if (2 * res.size() > n * n) {
    std::cout << -1 << std::endl;
    return 0;
  }
  std::cout << res.size() << std::endl;
  for (auto i : res) {
    for (auto j : i) std::cout << j + 1 << " ";
    std::cout << std::endl;
  }
  return 0;
}
