### main

n, rn, ln = gets.strip.split(' ').map{|s| s.to_i}

scores = n.times.map{0}
shots = n.times.map{0}

prev_d = 0
prev_t = 0

rn.times do
  d, t, x = gets.strip.split(' ').map{|s| s.to_i}
  d -= 1

  shots[prev_d] += t - prev_t
  scores[d] += x

  if x > 0
    if scores[prev_d] < scores[d]
      prev_d = d
    end
  elsif x < 0 && d == prev_d
    prev_d = (0...n).max do |a, b|
      (cmp = scores[a] <=> scores[b]) != 0 ? cmp : (b <=> a)
    end
  end

  prev_t = t
end

shots[prev_d] += ln - prev_t

max_d = (0...n).max do |a, b|
  (cmp = shots[a] <=> shots[b]) != 0 ? cmp : (b <=> a)
end

puts (max_d + 1)