#include <bits/stdc++.h>
using namespace std;
struct spell {
  int i;
  int a, b, c, d;
};
void fenwick_modify(set<int>** arr, int x, int y, int itm, int size,
                    bool insert) {
  while (x < size) {
    int y0 = y;
    while (y < size) {
      if (insert)
        arr[x][y].insert(itm);
      else
        arr[x][y].erase(itm);
      y |= (y + 1);
    }
    y = y0;
    x |= (x + 1);
  }
}
struct xy_query {
  int i;
  int x;
  int y;
  xy_query(int i, int x, int y) : i(i), x(x), y(y) {}
  bool operator<(xy_query other) const {
    return pair<int, int>(x, y) < pair<int, int>(other.x, other.y);
  }
};
set<int> fenwick_query(set<int>** arr, const vector<xy_query>& queries,
                       vector<int>& prevs) {
  set<xy_query> xy = set<xy_query>();
  for (xy_query q : queries) {
    int x = q.x;
    int y = q.y;
    while (x > 0) {
      int y0 = y;
      while (y > 0) {
        xy.insert(xy_query(q.i, x, y));
        y &= (y - 1);
      }
      y = y0;
      x &= (x - 1);
    }
  }
  set<int> result = set<int>();
  for (xy_query q : xy) {
    for (int k : arr[q.x - 1][q.y - 1]) {
      result.insert(k);
      prevs[k] = q.i;
    }
  }
  return result;
}
struct spell_queue {
  queue<spell> q;
  spell_queue() : q() {}
  void push(spell s) { q.push(s); }
  void init() {
    vector<spell> arr = vector<spell>();
    while (!q.empty()) {
      arr.push_back(q.front());
      q.pop();
    }
    sort(arr.begin(), arr.end(),
         [](spell s1, spell s2) { return s1.a < s2.a; });
    for (spell s : arr) q.push(s);
  }
};
int main() {
  int n;
  cin >> n;
  spell* arr = new spell[n];
  set<int> dict = set<int>();
  dict.insert(0);
  dict.insert(2147483647);
  for (int i = 0; i < n; i++) {
    cin >> arr[i].a >> arr[i].b >> arr[i].c >> arr[i].d;
    arr[i].i = i + 1;
    dict.insert(arr[i].c);
    dict.insert(arr[i].d);
  }
  vector<int> dict2 = vector<int>(dict.begin(), dict.end());
  for (int i = 0; i < n; i++) {
    arr[i].a =
        lower_bound(dict2.begin(), dict2.end(), arr[i].a) - dict2.begin();
    arr[i].b =
        lower_bound(dict2.begin(), dict2.end(), arr[i].b) - dict2.begin();
    arr[i].c =
        lower_bound(dict2.begin(), dict2.end(), arr[i].c) - dict2.begin();
    arr[i].d =
        lower_bound(dict2.begin(), dict2.end(), arr[i].d) - dict2.begin();
  }
  int size = dict2.size();
  spell_queue* table = new spell_queue[size];
  for (int i = 0; i < n; i++) {
    int x = arr[i].a;
    int y = arr[i].b;
    for (int j = y; j < size; j |= (j + 1)) {
      table[j].push(arr[i]);
    }
  }
  for (int i = 0; i < size; i++) {
    table[i].init();
  }
  set<int> allPrevious = set<int>();
  vector<int> prevs = vector<int>(n + 1);
  for (int i = 0; i <= n; i++) prevs[i] = -1;
  int step = 1;
  set<int>* curr = new set<int>();
  for (int i = 1; i <= n; i++) {
    if (arr[i - 1].a == 0 && arr[i - 1].b == 0) {
      prevs[i] = -1;
      curr->insert(i);
    }
  }
  if (curr->find(n) != curr->end()) {
    cout << 1 << endl;
    cout << n << endl;
  } else {
    set<int>* previous = new set<int>();
    while (!curr->empty()) {
      ++step;
      for (int i : *curr) {
        allPrevious.insert(i);
      }
      swap(curr, previous);
      curr->clear();
      for (int i : *previous) {
        spell s = arr[i - 1];
        int kx = s.c;
        int ky = s.d;
        for (int y = ky + 1; y > 0; y &= (y - 1)) {
          queue<spell>& q = table[y - 1].q;
          while (!q.empty() && q.front().a <= kx) {
            if (allPrevious.find(q.front().i) == allPrevious.end()) {
              curr->insert(q.front().i);
              prevs[q.front().i] = i;
            }
            q.pop();
          }
        }
      }
      if (curr->find(n) != curr->end()) {
        break;
      }
    }
    if (curr->empty()) {
      cout << -1 << endl;
    } else {
      cout << step << endl;
      vector<int> stk = vector<int>();
      stk.push_back(n);
      while (stk.back() > 0) {
        stk.push_back(prevs[stk.back()]);
      }
      stk.pop_back();
      while (!stk.empty()) {
        cout << stk.back();
        stk.pop_back();
        if (!stk.empty()) cout << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
