#include <bits/stdc++.h>
using namespace std;
long long a[1000010], b[1000010];
pair<int, int> vaz[1000010];
int main() {
  int n, p = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]);
  for (int i = 1; i <= n; i++) a[i] += a[i - 1];
  for (int i = 1; i <= n; i++) b[i] += b[i - 1];
  if (a[n] > b[n]) {
    p = 1;
    for (int i = 1; i <= n; i++) swap(a[i], b[i]);
  }
  vaz[0] = {0, 0};
  int poz = 1;
  pair<int, int> poz1, poz2;
  for (int i = 1; i <= n; i++) {
    while (poz <= n && b[poz] <= a[i]) poz++;
    poz--;
    int s = a[i] - b[poz];
    if (s == 0 or vaz[s].first != 0 or vaz[s].second != 0) {
      poz1 = {vaz[s].first, i};
      poz2 = {vaz[s].second, poz};
      break;
    }
    vaz[s] = {i, poz};
    poz++;
  }
  if (p == 1) swap(poz1, poz2);
  printf("%d\n", poz1.second - poz1.first);
  for (int i = poz1.first + 1; i <= poz1.second; i++) printf("%d ", i);
  printf("\n%d\n", poz2.second - poz2.first);
  for (int i = poz2.first + 1; i <= poz2.second; i++) printf("%d ", i);
  return 0;
}
