#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int N = 100010;
int parent[N], n, a[N], b[N], c[N], d[N], L, R, seg[4 * N + 1];
bool vis[N];
vector<pair<int, int> > A, B;
vector<int> path;
void build(int node, int i, int j) {
  if (i == j) {
    if (i >= n) {
      seg[node] = 0x3f3f3f3f;
    } else {
      seg[node] = b[A[i].second];
    }
  } else {
    int mid = (i + j) / 2;
    build((node * 2), i, mid);
    build((node * 2 + 1), mid + 1, j);
    seg[node] = min(seg[(node * 2)], seg[(node * 2 + 1)]);
  }
}
int query(int node, int i, int j) {
  if (i > R or j < L) return 0x3f3f3f3f;
  if (i >= L and j <= R) {
    return seg[node];
  }
  int mid = (i + j) / 2;
  int l = query((node * 2), i, mid);
  int r = query((node * 2 + 1), mid + 1, j);
  return min(l, r);
}
void update(int node, int i, int j, int val) {
  if (i > R or j < L) return;
  if (i >= L and j <= R) {
    seg[node] = val;
  } else {
    int mid = (i + j) / 2;
    update((node * 2), i, mid, val);
    update((node * 2 + 1), mid + 1, j, val);
    seg[node] = min(seg[(node * 2)], seg[(node * 2 + 1)]);
  }
}
int get_id(int node, int i, int j, int val) {
  if (i > R or j < L) return -1;
  if (i == j) {
    if (seg[node] == val) {
      return i;
    } else {
      return -1;
    }
  }
  int mid = (i + j) / 2;
  if (i >= L and j <= R) {
    if (seg[(node * 2)] == val) return get_id((node * 2), i, mid, val);
    return get_id((node * 2 + 1), mid + 1, j, val);
  }
  int x = get_id((node * 2), i, mid, val);
  int y = get_id((node * 2 + 1), mid + 1, j, val);
  return max(x, y);
}
void bfs() {
  memset(parent, -1, sizeof parent);
  queue<int> q;
  for (int i = 0; i < n; i++) {
    int k = A[i].second;
    if (!a[k] and !b[k]) {
      q.push(i);
      L = R = i;
      update(1, 0, N - 1, 0x3f3f3f3f);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (A[u].second == n - 1) {
      for (int v = u; v != -1; v = parent[v]) {
        path.push_back(A[v].second);
      }
      return;
    }
    int k = upper_bound(A.begin(), A.end(), make_pair(c[A[u].second] + 1, -1)) -
            A.begin() - 1;
    while (k != -1) {
      L = 0;
      R = k;
      int res = query(1, 0, N - 1);
      if (res > d[A[u].second]) break;
      int id = get_id(1, 0, N - 1, res);
      parent[id] = u;
      q.push(id);
      L = R = id;
      update(1, 0, N - 1, 0x3f3f3f3f);
    }
  }
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", a + i, b + i, c + i, d + i);
    A.push_back(make_pair(a[i], i));
  }
  sort(A.begin(), A.end());
  build(1, 0, N - 1);
  bfs();
  if (path.empty()) {
    printf("-1\n");
  } else {
    printf("%d\n", (int)path.size());
    for (int i = path.size() - 1; i >= 0; i--) {
      printf("%d ", path[i] + 1);
    }
    printf("\n");
  }
  return 0;
}
