#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int n, pos[N][2];
long long a[N], b[N];
bool flag;
long long read() {
  long long d = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) d = (d << 3) + (d << 1) + ch - 48, ch = getchar();
  return d;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] + read();
  for (int i = 1; i <= n; i++) b[i] = b[i - 1] + read();
  if (a[n] < b[n]) {
    for (int i = 1; i <= n; i++) swap(a[i], b[i]);
    flag = 1;
  }
  memset(pos, -1, sizeof(pos));
  for (int i = 0, j = 0; i <= n; i++) {
    while (j < n && a[i] >= b[j + 1]) j++;
    int k = a[i] - b[j];
    if (pos[k][0] >= 0) {
      if (flag) swap(i, j), swap(pos[k][0], pos[k][1]);
      printf("%d\n", i - pos[k][0]);
      for (int l = pos[k][0] + 1; l <= i; l++) printf("%d ", l);
      printf("\n%d\n", j - pos[k][1]);
      for (int l = pos[k][1] + 1; l <= j; l++) printf("%d ", l);
      return 0;
    }
    pos[k][0] = i;
    pos[k][1] = j;
  }
  return 0;
}
