#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n;
long long a[N], b[N];
int pa[N], push_back[N];
bool swp;
void out(int l1, int r1, int l2, int r2) {
  if (swp) {
    swap(l1, l2);
    swap(r1, r2);
  }
  printf("%d\n", r1 - l1);
  for (int i = l1 + 1; i <= r1; ++i) {
    printf("%d%c", i, " \n"[i == r1]);
  }
  printf("%d\n", r2 - l2);
  for (int i = l2 + 1; i <= r2; ++i) {
    printf("%d%c", i, " \n"[i == r2]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &b[i]);
    b[i] += b[i - 1];
  }
  if (a[n] > b[n]) {
    swap(a, b);
    swp = 1;
  }
  int x = 0;
  memset(pa, -1, sizeof pa);
  for (int i = 0; i <= n; ++i) {
    while (x + 1 <= n && b[x + 1] <= a[i]) {
      x++;
    }
    int r = a[i] - b[x];
    if (~pa[r]) {
      out(pa[r], i, push_back[r], x);
      return 0;
    }
    pa[r] = i;
    push_back[r] = x;
  }
  return 0;
}
