#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int> > s;
long long a[1 << 20];
long long b[1 << 20];
int main(void) {
  int n;
  ios_base ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i], a[i] += a[i - 1];
  for (int i = 1; i <= n; ++i) cin >> b[i], b[i] += b[i - 1];
  s[0] = {0, 0};
  bool ok = 0;
  if (a[n] > b[n]) swap(a, b), ok = 1;
  int ind = 0;
  for (int i = 1; i <= n; ++i) {
    while (ind < n && a[ind + 1] <= b[i]) ++ind;
    if (s.count(b[i] - a[ind])) {
      auto it = s[b[i] - a[ind]];
      if (ok) {
        cout << i - it.second << '\n';
        for (int j = it.second + 1; j <= i; ++j) cout << j << ' ';
        cout << '\n';
        cout << ind - it.first << '\n';
        for (int j = it.first + 1; j <= ind; ++j) cout << j << ' ';
        cout << '\n';
      } else {
        cout << ind - it.first << '\n';
        for (int j = it.first + 1; j <= ind; ++j) cout << j << ' ';
        cout << '\n';
        cout << i - it.second << '\n';
        for (int j = it.second + 1; j <= i; ++j) cout << j << ' ';
        cout << '\n';
      }
      return 0;
    }
    s[b[i] - a[ind]] = {ind, i};
  }
  assert(0);
  return 0;
}
