#include <bits/stdc++.h>
using namespace std;
inline int IN() {
  char c;
  register int first = 0;
  for (; (c = getchar()) < 48;)
    ;
  for (; c > 47; (c = getchar())) first = (first << 3) + (first << 1) + c - 48;
  return first;
}
inline void glance() { freopen("ha.in", "r", stdin); }
bool flag;
int n;
long long a[1000010], b[1000010];
pair<int, int> F[1000010];
int main() {
  n = IN();
  for (int _r = n, i = 1; i <= _r; ++i) a[i] = IN() + a[i - 1];
  for (int _r = n, i = 1; i <= _r; ++i) b[i] = IN() + b[i - 1];
  if (a[n] > b[n]) {
    flag = 1;
    for (int _r = n, i = 1; i <= _r; ++i) swap(a[i], b[i]);
  }
  for (int _r = n, i = 1; i < _r; ++i) F[i] = pair<int, int>(-1, -1);
  int j = 0;
  for (int _r = n, i = 1; i <= _r; ++i) {
    for (; j < n && b[j + 1] <= a[i]; ++j)
      ;
    pair<int, int> &W = F[a[i] - b[j]];
    if (W != pair<int, int>(-1, -1)) {
      if (flag) {
        printf("%d\n", j - W.second);
        for (int _r = j, k = W.second + 1; k <= _r; ++k)
          printf("%d%c", k, " \n"[k == j]);
        printf("%d\n", i - W.first);
        for (int _r = i, k = W.first + 1; k <= _r; ++k)
          printf("%d%c", k, " \n"[k == i]);
      } else {
        printf("%d\n", i - W.first);
        for (int _r = i, k = W.first + 1; k <= _r; ++k)
          printf("%d%c", k, " \n"[k == i]);
        printf("%d\n", j - W.second);
        for (int _r = j, k = W.second + 1; k <= _r; ++k)
          printf("%d%c", k, " \n"[k == j]);
      }
      return 0;
    } else {
      W = pair<int, int>(i, j);
    }
  }
}
