You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 ≤ i - a_i) or to the position i + a_i (if i + a_i ≤ n).

For each position i from 1 to n you want to know the minimum the number of moves required to reach any position j such that a_j has the opposite parity from a_i (i.e. if a_i is odd then a_j has to be even and vice versa).

Input

The first line of the input contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of elements in a.

The second line of the input contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n), where a_i is the i-th element of a.

Output

Print n integers d_1, d_2, ..., d_n, where d_i is the minimum the number of moves required to reach any position j such that a_j has the opposite parity from a_i (i.e. if a_i is odd then a_j has to be even and vice versa) or -1 if it is impossible to reach such a position.

Example

Input


10
4 5 7 6 7 5 4 4 6 4


Output


1 1 1 2 -1 1 1 3 1 1 
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
using namespace std;
struct UF {
  vector<int> e;
  UF(int n) : e(n, -1) {}
  bool same_set(int a, int b) { return find(a) == find(b); }
  int size(int x) { return -e[find(x)]; }
  int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
  void join(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return;
    if (e[a] > e[b]) swap(a, b);
    e[a] += e[b];
    e[b] = a;
  }
};
long long int p = 998244353;
long long int power(long long int a, int b) {
  if (!b) return 1;
  long long int ans = power(a, b / 2);
  ans = (ans * ans) % p;
  if (b % 2) ans = (ans * a) % p;
  return ans;
}
const int inf = 1e9;
struct Node {
  Node *l = 0, *r = 0;
  int lo, hi, mset = inf, madd = 0, val = -inf;
  Node(int lo, int hi) : lo(lo), hi(hi) {}
  Node(vector<int>& v, int lo, int hi) : lo(lo), hi(hi) {
    if (lo + 1 < hi) {
      int mid = lo + (hi - lo) / 2;
      l = new Node(v, lo, mid);
      r = new Node(v, mid, hi);
      val = max(l->val, r->val);
    } else
      val = v[lo];
  }
  int query(int L, int R) {
    if (R <= lo || hi <= L) return -inf;
    if (L <= lo && hi <= R) return val;
    push();
    return max(l->query(L, R), r->query(L, R));
  }
  void set(int L, int R, int x) {
    if (R <= lo || hi <= L) return;
    if (L <= lo && hi <= R)
      mset = val = x, madd = 0;
    else {
      push(), l->set(L, R, x), r->set(L, R, x);
      val = max(l->val, r->val);
    }
  }
  void add(int L, int R, int x) {
    if (R <= lo || hi <= L) return;
    if (L <= lo && hi <= R) {
      if (mset != inf)
        mset += x;
      else
        madd += x;
      val += x;
    } else {
      push(), l->add(L, R, x), r->add(L, R, x);
      val = max(l->val, r->val);
    }
  }
  void push() {
    if (!l) {
      int mid = lo + (hi - lo) / 2;
      l = new Node(lo, mid);
      r = new Node(mid, hi);
    }
    if (mset != inf)
      l->set(lo, hi, mset), r->set(lo, hi, mset), mset = inf;
    else if (madd)
      l->add(lo, hi, madd), r->add(lo, hi, madd), madd = 0;
  }
};
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n;
  cin >> n;
  int arr[n + 1];
  for (int i = 0; i < (n); ++i) cin >> arr[i + 1];
  int arr1[n + 1];
  for (int i = 0; i < (n); ++i) {
    arr1[i + 1] = arr[i + 1] % 2;
  }
  vector<vector<int>> ad(n + 1);
  bool visited[n + 1];
  memset(visited, 0, sizeof(visited));
  queue<int> temp;
  vector<int> ans(n + 1, -1);
  for (int i = 1; i <= n; i++) {
    if (i - arr[i] > 0 && (arr1[i] ^ arr1[i - arr[i]])) {
      temp.push(i);
      visited[i] = true;
      ans[i] = 1;
    } else if (i + arr[i] <= n && (arr1[i] ^ arr1[i + arr[i]])) {
      temp.push(i);
      visited[i] = true;
      ans[i] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i] + i <= n) {
      ad[i + arr[i]].push_back(i);
    }
    if (i - arr[i] > 0) {
      ad[i - arr[i]].push_back(i);
    }
  }
  while (!temp.empty()) {
    int a, b, c, d, e, f;
    a = temp.front();
    temp.pop();
    for (int i = 0; i < ad[a].size(); i++) {
      b = ad[a][i];
      if (visited[b] == false) {
        visited[b] = true;
        ans[b] = ans[a] + 1;
        temp.push(b);
      }
    }
  }
  for (int i = 0; i < (n); ++i) {
    cout << ans[i + 1] << " ";
  }
}
