#include <bits/stdc++.h>
const long long N = 1000005;
long long n, x, l[N][2], cnt[N], la, lb, ra, rb, rev;
std::vector<long long> a, b;
signed main() {
  scanf("%lld", &n);
  a.push_back(0), b.push_back(0);
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &x), a.push_back(a.back() + x);
  for (long long i = 1; i <= n; i++)
    scanf("%lld", &x), b.push_back(b.back() + x);
  if (a.back() > b.back()) rev = 1, std::swap(a, b);
  for (long long i = 0, j = 0; i <= n; i++) {
    for (; a[i] >= b[j] && j <= n; j++)
      ;
    j--;
    if (cnt[a[i] - b[j]]) {
      la = l[a[i] - b[j]][0] + 1, lb = l[a[i] - b[j]][1] + 1;
      ra = i, rb = j;
    }
    l[a[i] - b[j]][0] = i, l[a[i] - b[j]][1] = j;
    cnt[a[i] - b[j]] = 1;
  }
  if (rev) std::swap(la, lb), std::swap(ra, rb);
  printf("%lld\n", ra - la + 1);
  for (long long i = la; i <= ra; i++) printf("%lld ", i);
  printf("\n%lld\n", rb - lb + 1);
  for (long long i = lb; i <= rb; i++) printf("%lld ", i);
  return 0;
}
