#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:116777216")
using namespace std;
const int inf = 1000000000 + 100500;
const int sz = 1 << 17;
struct s_tp {
  int a, b, c, d, index;
} mas[sz];
int d[sz], from[sz], och[sz];
bool operator<(const s_tp &x, const s_tp &y) {
  return x.c < y.c || (x.c == y.c && x.d < y.d) ||
         (x.c == y.c && x.d == y.d && x.index < y.index);
}
struct my_tp {
  int first, second;
  my_tp() {}
  my_tp(int a, int b) : first(a), second(b) {}
};
int n;
set<my_tp> rmq[sz * 2];
vector<my_tp> to_del;
vector<int> v_ok;
bool operator<(const my_tp &A, const my_tp &B) {
  return A.first < B.first || (A.first == B.first && A.second < B.second);
}
void do_merge(int x, int y, int z) {
  rmq[z] = rmq[x];
  for (set<my_tp>::iterator iter = rmq[y].begin(); iter != rmq[y].end(); ++iter)
    rmq[z].insert(*iter);
}
void get_all_Ok(int min_c, int min_d, vector<int> &ans) {
  ans.clear();
  int down = 0, up = n;
  while (up > down) {
    int mid = (up + down) / 2;
    if (mas[mid].c >= min_c)
      up = mid;
    else
      down = mid + 1;
  }
  int l = down;
  int r = n - 1;
  int x = min_d;
  my_tp srch = my_tp(x, -inf);
  int s = 0;
  l += sz;
  r += sz;
  while (l <= r) {
    if (l % 2 == 1) {
      set<my_tp>::iterator iter = rmq[l].lower_bound(srch);
      to_del.clear();
      while (iter != rmq[l].end()) {
        ans.push_back(iter->second);
        to_del.push_back(*iter);
        ++iter;
      }
      for (int i = 0; i < (int)to_del.size(); i++) {
        set<my_tp>::iterator it = rmq[l].find(to_del[i]);
        if (it != rmq[l].end()) rmq[l].erase(it);
        it = rmq[l / 2].find(to_del[i]);
        if (it != rmq[l / 2].end()) rmq[l / 2].erase(it);
      }
    }
    if (r % 2 == 0) {
      set<my_tp>::iterator iter = rmq[r].lower_bound(srch);
      to_del.clear();
      while (iter != rmq[r].end()) {
        ans.push_back(iter->second);
        to_del.push_back(*iter);
        ++iter;
      }
      for (int i = 0; i < (int)to_del.size(); i++) {
        set<my_tp>::iterator it = rmq[r].find(to_del[i]);
        if (it != rmq[r].end()) rmq[r].erase(it);
        it = rmq[r / 2].find(to_del[i]);
        if (it != rmq[r / 2].end()) rmq[r / 2].erase(it);
      }
    }
    l = (l + 1) / 2;
    r = (r - 1) / 2;
  }
}
vector<int> ans_ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d%d", &mas[i].a, &mas[i].b, &mas[i].c, &mas[i].d);
    mas[i].index = i;
  }
  int last_a = mas[n - 1].a;
  int last_b = mas[n - 1].b;
  if (last_a <= 0 && last_b <= 0) {
    printf("1\n");
    printf("%d", n);
    return 0;
  }
  n--;
  if (n <= 0) {
    printf("-1");
    return 0;
  }
  sort(mas, mas + n);
  for (int i = 0; i < (int)(n); ++i) rmq[i + sz].insert(my_tp(mas[i].d, i));
  for (int i = (int)(sz)-1; i >= 0; --i)
    if (i) do_merge(i * 2, i * 2 + 1, i);
  get_all_Ok(last_a, last_b, v_ok);
  for (int i = 0; i < n; i++) {
    d[i] = inf;
    from[i] = -1;
  }
  int p_read = 0, p_write = 0;
  for (int i = 0; i < (int)v_ok.size(); i++) {
    d[v_ok[i]] = 0;
    och[p_write++] = v_ok[i];
  }
  while (p_read < p_write) {
    int v = och[p_read];
    if (mas[v].a <= 0 && mas[v].b <= 0) {
      int pp = p_read;
      ans_ans.clear();
      while (pp >= 0) {
        ans_ans.push_back(mas[och[pp]].index + 1);
        pp = from[pp];
      }
      ans_ans.push_back(n + 1);
      int QQ = (int)ans_ans.size();
      printf("%d\n", QQ);
      for (int i = 0; i < QQ; i++) {
        if (i > 0) printf(" ");
        printf("%d", ans_ans[i]);
      }
      return 0;
    }
    get_all_Ok(mas[v].a, mas[v].b, v_ok);
    for (int i = 0; i < (int)v_ok.size(); i++)
      if (d[v_ok[i]] > d[v] + 1) {
        och[p_write] = v_ok[i];
        d[v_ok[i]] = d[v] + 1;
        from[p_write] = p_read;
        p_write++;
      }
    p_read++;
  }
  printf("-1");
  return 0;
}
