#include <bits/stdc++.h>
using namespace std;
const int limite = 2000000;
int n;
int v[2][limite];
int visto[limite];
int ind[2][limite];
int iv[2];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int k = 0; k < 2; k++)
    for (int i = 0; i < n; i++) cin >> v[k][i];
  int pos = 0;
  visto[pos] = 1;
  for (;;) {
    if (pos + v[0][iv[0]] < n)
      pos = pos + v[0][iv[0]++];
    else if (pos - v[1][iv[1]] >= 0)
      pos = pos - v[1][iv[1]++];
    else
      pos = pos + v[0][iv[0]++] - v[1][iv[1]++];
    if (visto[pos]) {
      for (int k = 0; k <= 1; k++) {
        vector<int> sol;
        for (int i = ind[k][pos]; i < iv[k]; i++) sol.push_back(i + 1);
        cout << int(sol.size()) << endl;
        for (int i = 0; i < int(sol.size()); i++) {
          if (i > 0) cout << " ";
          cout << sol[i];
        }
        cout << endl;
      }
      break;
    }
    visto[pos] = 1;
    for (int k = 0; k <= 1; k++) ind[k][pos] = iv[k];
  }
}
