#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
long long s1[N], s2[N];
int p, q, n, b[N], d[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &s1[i]), s1[i] += s1[i - 1];
  for (int i = 1; i <= n; i++) scanf("%I64d", &s2[i]), s2[i] += s2[i - 1];
  for (int i = 0; i <= n; i++) {
    while (s1[i] > s2[p] && p <= n) p++;
    if (s1[i] <= s2[p] && b[s2[p] - s1[i]]) {
      q = b[s2[p] - s1[i]] - 1;
      printf("%d\n", i - q);
      for (int j = q + 1; j <= i; j++) printf("%d ", j);
      q = d[s2[p] - s1[i]];
      putchar('\n');
      printf("%d\n", p - q);
      for (int j = q + 1; j <= p; j++) printf("%d ", j);
      return 0;
    } else
      b[s2[p] - s1[i]] = i + 1, d[s2[p] - s1[i]] = p;
  }
  return 0;
}
