#include <bits/stdc++.h>
using namespace std;
int n, second[1000005], L[1000005];
vector<pair<long long, long long> > V[2];
bool boo;
void go(int s1, int e1, int s2, int e2) {
  if (boo) {
    swap(s1, s2);
    swap(e1, e2);
    swap(V[0], V[1]);
  }
  printf("%d\n", e1 - s1);
  for (int i = s1 + 1; i <= e1; i++) printf("%lld ", V[0][i].second);
  printf("\n%d\n", e2 - s2);
  for (int i = s2 + 1; i <= e2; i++) printf("%lld ", V[1][i].second);
  printf("\n");
}
int main() {
  scanf("%d", &n);
  for (int j = 0; j < 2; j++) {
    V[j].push_back(make_pair(0, 0));
    for (int i = 1; i <= n; i++) {
      long long a;
      scanf("%lld", &a);
      V[j].push_back(make_pair(a, i));
    }
    sort(V[j].begin(), V[j].end());
  }
  for (int j = 0; j < 2; j++)
    for (int i = 1; i <= n; i++) V[j][i].first += V[j][i - 1].first;
  for (int i = 0; i <= n; i++) second[i] = -1;
  if (V[0][n].first > V[1][n].first) {
    boo = 1;
    swap(V[0], V[1]);
  }
  int ind = 0;
  for (int i = 0; i <= n; i++) {
    while (ind < n && V[1][ind + 1].first <= V[0][i].first) ind++;
    L[i] = ind;
    long long r = V[0][i].first - V[1][ind].first;
    if (second[r] != -1) {
      go(second[r], i, L[second[r]], L[i]);
      break;
    } else
      second[r] = i;
  }
  return 0;
}
