#include <bits/stdc++.h>
const int maxn(1e6 + 10);
int n, posa[maxn], posb[maxn], flag;
long long A[maxn], B[maxn];
void print(int l1, int r1, int l2, int r2) {
  if (flag) std::swap(l1, l2), std::swap(r1, r2);
  printf("%d\n", r1 - l1);
  for (register int i = l1 + 1; i <= r1; i++) printf("%d ", i);
  printf("\n%d\n", r2 - l2);
  for (register int i = l2 + 1; i <= r2; i++) printf("%d ", i);
  exit(0);
}
int main() {
  scanf("%d", &n);
  for (register int i = 1, x; i <= n; i++) scanf("%d", &x), A[i] = A[i - 1] + x;
  for (register int i = 1, x; i <= n; i++) scanf("%d", &x), B[i] = B[i - 1] + x;
  if (A[n] > B[n]) std::swap(A, B), flag = 1;
  std::fill(posa, posa + n + 1, -1);
  for (register int i = 0, j = 0; i <= n; i++) {
    while (B[j] < A[i]) ++j;
    int delt = B[j] - A[i];
    if (~posa[delt]) print(posa[delt], i, posb[delt], j);
    posa[delt] = i, posb[delt] = j;
  }
  puts("-1");
  return 0;
}
