#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
const int M = 1E6 + 10;
int n, m, bh[2][N], bit[50];
int on[2], data[N], fuck[N];
int scan() {
  int i = 0;
  scanf("%d", &i);
  return i;
}
typedef bitset<31> Matrix[N];
Matrix mata, matb;
pair<int, int> out[2][M];
void Swap(int i, int j, int bh[], int &on, pair<int, int> out[]) {
  if (i == j) return;
  on++;
  out[on] = pair<int, int>(i, j);
  on++;
  out[on] = pair<int, int>(j, i);
  on++;
  out[on] = pair<int, int>(i, j);
}
int gauss(int n, Matrix a, int bh[], int &on, pair<int, int> out[]) {
  int i, j, top;
  for (i = 1, top = 30; i <= n && top >= 0; top--, i++) {
    int r = i;
    for (j = i; j <= n; j++)
      if (a[j][top]) {
        r = j;
        break;
      }
    if (!a[r][top]) {
      i--;
      continue;
    }
    swap(a[i], a[r]);
    Swap(i, r, bh, on, out);
    for (j = 1; j <= n; j++)
      if (i != j && a[j][top]) {
        a[j] ^= a[i];
        on++;
        out[on] = pair<int, int>(j, i);
      }
    bit[i] = top;
  }
  return i - 1;
}
void print(Matrix a) {
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 10; j >= 0; j--) printf("%d ", (int)a[i][j]);
    printf("\n");
  }
}
int main() {
  int i, j, a, b;
  n = scan();
  for (i = 1; i <= n; i++) {
    mata[i] = scan();
    bh[0][i] = bh[1][i] = i;
    fuck[i] = i;
  }
  for (i = 1; i <= n; i++) matb[i] = data[i] = scan();
  int rank[2];
  rank[1] = gauss(n, matb, bh[1], on[1], out[1]);
  rank[0] = gauss(n, mata, bh[0], on[0], out[0]);
  bool ok = 1;
  if (rank[1] > rank[0]) ok = 0;
  for (i = 1; i <= rank[0] && ok; i++) {
    for (j = i; j <= rank[0] && ok; j++)
      if (mata[i][bit[j]] != matb[i][bit[j]]) {
        on[0]++;
        out[0][on[0]] = pair<int, int>(bh[0][i], bh[0][j]);
        mata[i] ^= mata[j];
      }
    if (mata[i] != matb[i]) ok = 0;
  }
  if (ok) {
    printf("%d\n", on[0] + on[1]);
    for (i = 1; i <= on[0]; i++)
      printf("%d %d\n", out[0][i].first, out[0][i].second);
    for (i = on[1]; i; i--)
      printf("%d %d\n", out[1][i].first, out[1][i].second);
  } else
    printf("-1\n");
  return 0;
}

### Prompt

Create a solution in CPP for the following problem:

There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.

Let's have a try. I have created the following task for Topcoder SRM 557 Div1-Hard: you are given n integers x1, x2, ..., xn. You are allowed to perform the assignments (as many as you want) of the following form xi ^= xj (in the original task i and j must be different, but in this task we allow i to equal j). The goal is to maximize the sum of all xi.

Now we just change the goal. You are also given n integers y1, y2, ..., yn. You should make x1, x2, ..., xn exactly equal to y1, y2, ..., yn. In other words, for each i number xi should be equal to yi.

Input

The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).

Output

If there is no solution, output -1.

If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj.

If there are multiple solutions you can print any of them. We can prove that under these constraints if there exists a solution then there always exists a solution with no more than 106 operations.

Examples

Input

2
3 5
6 0


Output

2
1 2
2 2


Input

5
0 0 0 0 0
1 2 3 4 5


Output

-1


Input

3
4 5 6
1 2 3


Output

5
3 1
1 2
2 2
2 3
3 1


Input

3
1 2 3
4 5 6


Output

-1

Note

Assignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 10;
const int M = 1E6 + 10;
int n, m, bh[2][N], bit[50];
int on[2], data[N], fuck[N];
int scan() {
  int i = 0;
  scanf("%d", &i);
  return i;
}
typedef bitset<31> Matrix[N];
Matrix mata, matb;
pair<int, int> out[2][M];
void Swap(int i, int j, int bh[], int &on, pair<int, int> out[]) {
  if (i == j) return;
  on++;
  out[on] = pair<int, int>(i, j);
  on++;
  out[on] = pair<int, int>(j, i);
  on++;
  out[on] = pair<int, int>(i, j);
}
int gauss(int n, Matrix a, int bh[], int &on, pair<int, int> out[]) {
  int i, j, top;
  for (i = 1, top = 30; i <= n && top >= 0; top--, i++) {
    int r = i;
    for (j = i; j <= n; j++)
      if (a[j][top]) {
        r = j;
        break;
      }
    if (!a[r][top]) {
      i--;
      continue;
    }
    swap(a[i], a[r]);
    Swap(i, r, bh, on, out);
    for (j = 1; j <= n; j++)
      if (i != j && a[j][top]) {
        a[j] ^= a[i];
        on++;
        out[on] = pair<int, int>(j, i);
      }
    bit[i] = top;
  }
  return i - 1;
}
void print(Matrix a) {
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 10; j >= 0; j--) printf("%d ", (int)a[i][j]);
    printf("\n");
  }
}
int main() {
  int i, j, a, b;
  n = scan();
  for (i = 1; i <= n; i++) {
    mata[i] = scan();
    bh[0][i] = bh[1][i] = i;
    fuck[i] = i;
  }
  for (i = 1; i <= n; i++) matb[i] = data[i] = scan();
  int rank[2];
  rank[1] = gauss(n, matb, bh[1], on[1], out[1]);
  rank[0] = gauss(n, mata, bh[0], on[0], out[0]);
  bool ok = 1;
  if (rank[1] > rank[0]) ok = 0;
  for (i = 1; i <= rank[0] && ok; i++) {
    for (j = i; j <= rank[0] && ok; j++)
      if (mata[i][bit[j]] != matb[i][bit[j]]) {
        on[0]++;
        out[0][on[0]] = pair<int, int>(bh[0][i], bh[0][j]);
        mata[i] ^= mata[j];
      }
    if (mata[i] != matb[i]) ok = 0;
  }
  if (ok) {
    printf("%d\n", on[0] + on[1]);
    for (i = 1; i <= on[0]; i++)
      printf("%d %d\n", out[0][i].first, out[0][i].second);
    for (i = on[1]; i; i--)
      printf("%d %d\n", out[1][i].first, out[1][i].second);
  } else
    printf("-1\n");
  return 0;
}

```