#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * power(a * a % md, b / 2, md) % md
                      : power(a * a % md, b / 2, md) % md));
}
const int xn = 1e6 + 10;
const int xm = -20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const long long INF = 1e18 + 10;
const int mod = 998244353;
const int base = 257;
int n, c[xn], ptr;
pair<long long, long long> a[xn], part[xn], ans[2];
vector<pair<int, int> > vec[xn];
bool flag;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cin >> a[i].first, part[i].first = part[i - 1].first + a[i].first;
  for (int i = 1; i <= n; ++i)
    cin >> a[i].second, part[i].second = part[i - 1].second + a[i].second;
  if (part[n].first > part[n].second) {
    for (int i = 1; i <= n; ++i) {
      swap(a[i].first, a[i].second);
      swap(part[i].first, part[i].second);
    }
    flag = true;
  }
  for (int i = 0; i <= n; ++i) {
    while (part[ptr].second < part[i].first) ++ptr;
    vec[part[ptr].second - part[i].first].push_back({i, ptr});
  }
  for (int i = 0; i < n; ++i) {
    if (int(vec[i].size()) < 2) continue;
    ans[0] = vec[i][0];
    ans[1] = vec[i][1];
    break;
  }
  if (flag) {
    swap(ans[0].first, ans[0].second);
    swap(ans[1].first, ans[1].second);
  }
  cout << ans[1].first - ans[0].first << '\n';
  for (int i = ans[0].first + 1; i <= ans[1].first; ++i) cout << i << ' ';
  cout << '\n';
  cout << ans[1].second - ans[0].second << '\n';
  for (int i = ans[0].second + 1; i <= ans[1].second; ++i) cout << i << ' ';
  cout << '\n';
  return 0;
}
