#include <bits/stdc++.h>
using namespace std;
struct node {
  int y, id;
  pair<pair<int, int>, int> key, mn;
  int l, r;
};
node nd[400001];
int pr[100001];
int c[100001];
int d[100001];
int ct = 0;
const int INF = 1e9 + 7;
int my_rand() { return rand() * RAND_MAX + rand(); }
int new_nd(int a, int b, int id) {
  ct++;
  nd[ct].key = make_pair(make_pair(a, b), id);
  nd[ct].mn = nd[ct].key;
  nd[ct].l = nd[ct].r = 0;
  nd[ct].id = id;
  nd[ct].y = my_rand();
  return ct;
}
int root = 0;
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.second == b.first.second
             ? (a.first.first == b.first.first ? a.second <= b.second
                                               : a.first.first < b.first.first)
             : a.first.second < b.first.second;
}
int refresh(int a) {
  nd[a].mn = min(min(nd[a].key, nd[nd[a].l].mn), nd[nd[a].r].mn);
  return a;
}
pair<int, int> split(int a, pair<pair<int, int>, int> x) {
  if (a == 0) return make_pair(0, 0);
  if (cmp(nd[a].key, x)) {
    pair<int, int> p = split(nd[a].r, x);
    nd[a].r = p.first;
    return make_pair(refresh(a), p.second);
  }
  pair<int, int> p = split(nd[a].l, x);
  nd[a].l = p.second;
  return make_pair(p.first, refresh(a));
}
int merge(int a, int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (nd[a].y > nd[b].y) {
    nd[a].r = merge(nd[a].r, b);
    return refresh(a);
  }
  nd[b].l = merge(a, nd[b].l);
  return refresh(b);
}
void insert(int a, int b, int id) {
  pair<int, int> p = split(root, make_pair(make_pair(a, b), id));
  pair<int, int> q = split(p.first, make_pair(make_pair(a, b), id - 1));
  q.second = new_nd(a, b, id);
  p.first = merge(q.first, q.second);
  root = merge(p.first, p.second);
}
queue<int> q;
pair<int, int> get(int a) {
  pair<pair<int, int>, int> k = nd[a].mn;
  pair<int, int> p = split(a, k);
  k.second--;
  pair<int, int> q = split(p.first, k);
  a = merge(q.first, p.second);
  return make_pair(a, nd[q.second].id);
}
void pushs(int x, int y, int id) {
  pair<int, int> p = split(root, make_pair(make_pair(-1, y + 1), id));
  while (p.first != 0 && nd[p.first].mn.first.first <= x) {
    pair<int, int> k = get(p.first);
    p.first = k.first;
    pr[k.second] = id;
    q.push(k.second);
  }
  root = merge(p.first, p.second);
}
int main() {
  int n;
  cin >> n;
  srand(time(NULL));
  nd[0].mn = make_pair(make_pair(INF, INF), -1);
  for (int i = 0; i < n; i++) {
    pr[i] = -1;
    int a, b;
    cin >> a >> b >> c[i] >> d[i];
    insert(a, b, i);
  }
  c[n] = d[n] = 0;
  q.push(n);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    pushs(c[x], d[x], x);
  }
  if (pr[n - 1] == -1) {
    cout << -1;
    return 0;
  }
  vector<int> ans;
  int s = n - 1;
  while (s != n) {
    ans.push_back(s);
    s = pr[s];
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (auto v : ans) {
    cout << v + 1 << " ";
  }
  return 0;
}
