#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int> > s;
long long a[1 << 20];
long long b[1 << 20];
int main(void) {
  int n;
  ios_base ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i], a[i] += a[i - 1];
  for (int i = 1; i <= n; ++i) cin >> b[i], b[i] += b[i - 1];
  s[0] = {0, 0};
  bool ok = 0;
  if (a[n] > b[n]) swap(a, b), ok = 1;
  int index = 0, l1, l2, r1, r2;
  for (int i = 1; i <= n; ++i) {
    while (index < n && a[index + 1] <= b[i]) ++index;
    if (s.count(b[i] - a[index])) {
      auto it = s[b[i] - a[index]];
      l1 = it.second + 1;
      r1 = i;
      l2 = it.first + 1;
      r2 = index;
      break;
    }
    s[b[i] - a[index]] = {index, i};
  }
  if (!ok) swap(l1, l2), swap(r1, r2);
  cout << (r1 - l1 + 1) << '\n';
  for (int i = l1; i <= r1; ++i) cout << i << " \n"[i == r1];
  cout << (r2 - l2 + 1) << '\n';
  for (int i = l2; i <= r2; ++i) cout << i << " \n"[i == r2];
  return 0;
}
