#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 1, s = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return w * s;
}
long long Suma[1010010], Sumb[1010010];
int n;
pair<int, int> tmp[1010100];
map<int, pair<int, int> > Fuck;
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i) Suma[i] = Suma[i - 1] + read();
  for (register int i = 1; i <= n; ++i) Sumb[i] = Sumb[i - 1] + read();
  for (register int i = 0; i <= n; ++i) {
    int x = upper_bound(Sumb, Sumb + n + 1, Suma[i]) - Sumb - 1;
    int tmp = Suma[i] - Sumb[x];
    pair<int, int> u = make_pair(i, x);
    if (Fuck.count(tmp)) {
      pair<int, int> o = Fuck[tmp];
      cout << u.first - o.first << "\n";
      for (register int i = o.first + 1; i <= u.first; ++i) cout << i << " ";
      cout << endl;
      cout << u.second - o.second << "\n";
      for (register int i = o.second + 1; i <= u.second; ++i) cout << i << " ";
      exit(0);
    }
    Fuck[tmp] = make_pair(i, x);
  }
  return 0;
}
