#include <bits/stdc++.h>
template <class T>
inline void read(T &x) {
  char c;
  int f = 1;
  x = 0;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    f = -1;
  else
    x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= f;
}
const int N = 100009;
int n;
int a[N], b[N], c[N], d[N];
int val[N], val_n;
std::vector<int> each[N];
int min[N << 2];
int q[N], l, r;
int pre[N], dis[N];
inline void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(a[i]), read(b[i]), read(c[i]), read(d[i]);
    val[++val_n] = a[i];
  }
  c[0] = 1;
}
inline int id(int x) {
  return std::upper_bound(val + 1, val + val_n + 1, x) - val - 1;
}
inline bool cmp(const int &p, const int &q) { return b[p] > b[q]; }
inline void discrete() {
  val[++val_n] = 0;
  std::sort(val + 1, val + val_n + 1);
  val_n = std::unique(val + 1, val + val_n + 1) - val - 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = id(a[i]), c[i] = id(c[i]);
    each[a[i]].push_back(i);
  }
  for (int i = 1; i <= val_n; ++i)
    std::sort(each[i].begin(), each[i].end(), cmp);
}
inline void update(int x) {
  if (min[x << 1] && min[x << 1 | 1])
    min[x] = min[x << 1 | cmp(min[x << 1], min[x << 1 | 1])];
  else if (min[x << 1])
    min[x] = min[x << 1];
  else
    min[x] = min[x << 1 | 1];
}
void build(int x, int l, int r) {
  if (l == r) {
    if ((int)(each[l]).size()) {
      min[x] = *each[l].rbegin();
      each[l].pop_back();
    }
    return;
  }
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  update(x);
}
bool query(int x, int l, int r, int fr) {
  if (!min[x] || b[min[x]] > d[fr]) return false;
  if (l == r) {
    if (b[min[x]] <= d[fr]) {
      pre[min[x]] = fr, dis[min[x]] = dis[fr] + 1, q[++::r] = min[x];
      if ((int)(each[l]).size())
        min[x] = *each[l].rbegin(), each[l].pop_back();
      else
        min[x] = 0;
      return true;
    } else
      return false;
  }
  int mid = (l + r) >> 1;
  bool ret = false;
  if (c[fr] <= mid)
    ret = query(x << 1, l, mid, fr);
  else {
    if (query(x << 1, l, mid, fr))
      ret = true;
    else
      ret = query(x << 1 | 1, mid + 1, r, fr);
  }
  update(x);
  return ret;
}
void print(int x) {
  if (x) {
    print(pre[x]);
    printf("%d%c", x, x == n ? '\n' : ' ');
  }
}
inline void solve() {
  discrete();
  build(1, 1, val_n);
  memset(dis, -1, sizeof dis);
  q[++r] = 0, dis[0] = 0;
  while (l < r) {
    int now = q[++l];
    while (query(1, 1, val_n, now))
      ;
    if (dis[n] != -1) break;
  }
  printf("%d\n", dis[n]);
  if (dis[n] != -1) print(n);
}
int main() {
  init();
  solve();
  return 0;
}
