#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
  }
  map<int, pair<int, int> > mp;
  mp[0] = pair<int, int>(-1, -1);
  long long sa(0), sb(0);
  for (int i = 0, j = 0; i < n; ++i, ++j) {
    sa += a[i];
    while (j < n && sb + b[j] <= sa) {
      sb += b[j];
      ++j;
    }
    j--;
    if (mp.count(sa - sb)) {
      int na = mp[sa - sb].first;
      int nb = mp[sa - sb].second;
      printf("%d\n", i - na);
      for (int x = na + 1; x <= i; ++x) printf("%d ", x + 1);
      puts("");
      printf("%d\n", j - nb);
      for (int x = nb + 1; x <= j; ++x) printf("%d ", x + 1);
      puts("");
      break;
    }
    mp[sa - sb] = pair<int, int>(i, j);
  }
  return 0;
}
