#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<ll, ll>;
using vi = vector<ll>;
using ld = long double;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (ll i = ll(0); i < ll((ll)v.size()); i++) {
    if (i) os << ",";
    os << v[i];
  }
  os << "]";
  return os;
}
ll read() {
  ll i;
  scanf("%lld", &i);
  return i;
}
void printSpace() { printf(" "); }
void printEoln() { printf("\n"); }
void print(ll x, ll suc = 1) {
  printf("%lld", x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}
string readString() {
  static char buf[3341919];
  scanf("%s", buf);
  return string(buf);
}
char* readCharArray() {
  static char buf[3341919];
  static ll bufUsed = 0;
  char* ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}
template <class T, class U>
void chmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void chmin(T& a, U b) {
  if (a > b) a = b;
}
template <class T>
T Sq(const T& t) {
  return t * t;
}
signed main() {
  ll n = read();
  vi a, b;
  vector<pi> memo(2 * n, pi(-1, -1));
  memo[n] = pi(0, 0);
  for (ll i = ll(0); i < ll(n); i++) a.push_back(read());
  for (ll i = ll(0); i < ll(n); i++) b.push_back(read());
  ll x = 1, y = 1, dif = a[0] - b[0];
  while (memo[dif + n] == pi(-1, -1)) {
    memo[dif + n] = pi(x, y);
    if (dif < 0) {
      assert(x < n);
      dif += a[x++];
    } else {
      assert(y < n);
      dif -= b[y++];
    }
  }
  print(x - memo[dif + n].first);
  for (ll i = ll(memo[dif + n].first); i < ll(x); i++)
    print(i + 1, i == x - 1 ? 1 : 2);
  print(y - memo[dif + n].second);
  for (ll i = ll(memo[dif + n].second); i < ll(y); i++)
    print(i + 1, i == y - 1 ? 1 : 2);
}
