#include <bits/stdc++.h>
using namespace std;
int n;
long long a[1000010], b[1000010];
int bm[1000010];
int id[1000010];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    b[i] += b[i - 1];
  }
  bool swapped = 0;
  if (a[n] > b[n]) {
    swap(a, b);
    swapped = 1;
  }
  for (int i = 1; i <= n; i++) {
    bm[i] = bm[i - 1];
    while (bm[i] < n && b[bm[i] + 1] <= a[i]) bm[i]++;
  }
  memset(id, -1, sizeof(id));
  for (int i = 0; i <= n; i++) {
    int diff = a[i] - b[bm[i]];
    if (id[diff] == -1) {
      id[diff] = i;
    } else {
      int j = id[diff];
      if (!swapped) {
        cout << i - j << '\n';
        for (int k = j + 1; k <= i; k++) cout << k << ' ';
        cout << '\n';
        cout << bm[i] - bm[j] << '\n';
        for (int k = bm[j] + 1; k <= bm[i]; k++) cout << k << ' ';
        cout << '\n';
      } else {
        cout << bm[i] - bm[j] << '\n';
        for (int k = bm[j] + 1; k <= bm[i]; k++) cout << k << ' ';
        cout << '\n';
        cout << i - j << '\n';
        for (int k = j + 1; k <= i; k++) cout << k << ' ';
        cout << '\n';
      }
      return 0;
    }
  }
  cout << -1 << '\n';
}
