#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
int n;
long long a[maxn], b[maxn];
tuple<long long, int, int> p[maxn];
int main() {
  scanf("%d", &n);
  a[0] = b[0] = 0;
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]), a[i] += a[i - 1];
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]), b[i] += b[i - 1];
  if (a[n] > b[n]) {
    for (int i = 0; i <= n; i++) {
      int j = upper_bound(b, b + 1 + n, a[i]) - b - 1;
      p[i] = make_tuple(a[i] - b[j], i, j);
      assert(get<0>(p[i]) == a[get<1>(p[i])] - b[get<2>(p[i])]);
    }
  } else {
    for (int i = 0; i <= n; i++) {
      int j = upper_bound(a, a + 1 + n, b[i]) - a - 1;
      p[i] = make_tuple(a[j] - b[i], j, i);
      assert(get<0>(p[i]) == a[get<1>(p[i])] - b[get<2>(p[i])]);
    }
  }
  sort(p, p + 1 + n);
  for (int i = 0; i < n; i++)
    if (get<0>(p[i]) == get<0>(p[i + 1])) {
      int a1, b1, a2, b2, v1, v2;
      tie(v1, a1, b1) = p[i];
      tie(v2, a2, b2) = p[i + 1];
      assert(a1 == get<1>(p[i]));
      assert(b1 == get<2>(p[i]));
      assert(v1 == get<0>(p[i]));
      assert(v1 == v2);
      printf("%d\n", a2 - a1);
      for (int t = a1 + 1; t <= a2; t++) printf("%d ", t);
      printf("\n");
      printf("%d\n", b2 - b1);
      for (int t = b1 + 1; t <= b2; t++) printf("%d ", t);
      printf("\n");
      return 0;
    }
  printf("-1\n");
  return 0;
}
