#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
inline int safe_mul(const int x, const int y)
    __attribute__((warn_unused_result));
void printSeg(int s, int f) {
  cout << f - s << endl;
  for (int i = s + 1; i <= f; ++i) cout << i << " \n"[i == f];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto& x : a) cin >> x;
  vector<long long> b(n);
  for (auto& x : b) cin >> x;
  vector<long long> sa = {0};
  auto sb = sa;
  partial_sum(begin(a), end(a), back_inserter(sa));
  partial_sum(begin(b), end(b), back_inserter(sb));
  map<int, pair<int, int>> mp;
  bool sw = false;
  if (sa.back() > sb.back()) {
    swap(sa, sb);
    sw = true;
  }
  for (int i = 0; i <= n; ++i) {
    auto j = lower_bound(begin(sb), end(sb), sa[i]) - begin(sb);
    int val = sb[j] - sa[i];
    if (mp.find(val) != mp.end()) {
      auto it = mp.find(val);
      if (!sw) {
        printSeg(it->second.first, i);
        printSeg(it->second.second, j);
      } else {
        printSeg(it->second.second, j);
        printSeg(it->second.first, i);
      }
      return 0;
    }
    mp[val] = {i, j};
  }
}
