#include <bits/stdc++.h>
using namespace std;
long long A[2000005], B[2000005];
int lA[2000005], lB[2000005], n;
long long gi() {
  long long x;
  scanf("%lld", &x);
  return x;
}
bool flag;
void Print(int l1, int r1, int l2, int r2) {
  if (!flag) {
    printf("%d\n", r1 - l1);
    for (int j = l1 + 1; j <= r1; j++) printf("%d ", j);
    printf("\n%d\n", r2 - l2);
    for (int j = l2 + 1; j <= r2; j++) printf("%d ", j);
  } else {
    printf("%d\n", r2 - l2);
    for (int j = l2 + 1; j <= r2; j++) printf("%d ", j);
    printf("\n%d\n", r1 - l1);
    for (int j = l1 + 1; j <= r1; j++) printf("%d ", j);
  }
}
int main() {
  n = gi();
  for (int i = 1; i <= n; i++) A[i] = gi(), A[i] += A[i - 1];
  for (int i = 1; i <= n; i++) B[i] = gi(), B[i] += B[i - 1];
  if (A[n] < B[n]) {
    for (int i = 1; i <= n; i++) swap(A[i], B[i]);
    flag = true;
  }
  memset(lA, -1, sizeof(lA));
  memset(lB, -1, sizeof(lB));
  lA[0] = 0;
  lB[0] = 0;
  for (int i = 1, j = 1; i <= n; i++) {
    while (j < n && A[j] < B[i]) ++j;
    int d = A[j] - B[i];
    if (lA[d] != -1) {
      Print(lA[d], j, lB[d], i);
      return 0;
    }
    lA[d] = j;
    lB[d] = i;
  }
  puts("-1");
  return 0;
}
