#include <bits/stdc++.h>
using namespace std;
const int MN = 1000111;
int n;
pair<int, int> a[MN], b[MN];
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  while (scanf("%d", &n) == 1) {
    for (int i = (1), _b = (n); i <= _b; ++i) {
      scanf("%d", &a[i].first);
      a[i].second = i;
    }
    for (int i = (1), _b = (n); i <= _b; ++i) {
      scanf("%d", &b[i].first);
      b[i].second = i;
    }
    try {
      while (true) {
        map<int, pair<int, int> > id;
        id[0] = make_pair(0, 0);
        int ia = 0, ib = 0;
        int diff = 0;
        while (ia < n || ib < n) {
          if (ia == n) {
            diff -= b[++ib].first;
          } else if (ib == n) {
            diff += a[++ia].first;
          } else if (diff <= 0) {
            diff += a[++ia].first;
          } else {
            diff -= b[++ib].first;
          }
          if (id.count(diff)) {
            int ja = id[diff].first;
            int jb = id[diff].second;
            printf("%d\n", ia - ja);
            for (int x = (ja + 1), _b = (ia); x <= _b; ++x)
              printf("%d ", a[x].second);
            puts("");
            printf("%d\n", ib - jb);
            for (int x = (jb + 1), _b = (ib); x <= _b; ++x)
              printf("%d ", b[x].second);
            puts("");
            puts("");
            throw 1;
          }
          id[diff] = make_pair(ia, ib);
        }
        throw 2;
        random_shuffle(a + 1, a + n + 1);
        random_shuffle(b + 1, b + n + 1);
      }
    } catch (int e) {
    }
  }
}
