#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, A[N], B[N];
long long a[N], b[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    a[i] = a[i - 1] + A[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> B[i];
    b[i] = b[i - 1] + B[i];
  }
  map<int, pair<int, int> > q;
  q[0] = make_pair(1, 1);
  for (int i = 1, j = 0; i <= n; i++) {
    while (j + 1 <= n && b[j + 1] <= a[i]) {
      j++;
    }
    int cur = a[i] - b[j];
    if (q.find(cur) != q.end()) {
      cout << i - q[cur].first + 1 << "\n";
      for (int k = q[cur].first; k <= i; k++) {
        cout << k << " ";
      }
      cout << "\n" << j - q[cur].second + 1 << "\n";
      for (int k = q[cur].second; k <= j; k++) {
        cout << k << " ";
      }
      return 0;
    }
    q[cur] = make_pair(i + 1, j + 1);
  }
  q.clear();
  q[0] = make_pair(1, 1);
  for (int i = 1, j = 0; i <= n; i++) {
    while (j + 1 <= n && a[j + 1] <= b[i]) {
      j++;
    }
    int cur = b[i] - a[j];
    if (q.find(cur) != q.end()) {
      cout << j - q[cur].second + 1 << "\n";
      for (int k = q[cur].second; k <= j; k++) {
        cout << k << " ";
      }
      cout << "\n" << i - q[cur].first + 1 << "\n";
      for (int k = q[cur].first; k <= i; k++) {
        cout << k << " ";
      }
      return 0;
    }
    q[cur] = make_pair(i + 1, j + 1);
  }
  assert(false);
  cout << "-1";
}
