#!/usr/bin/python
# This code was taken from http://had00b.blogspot.co.uk/2013/07/random-subset-in-mapreduce.html

import sys

k = int(sys.argv[1])
c = 0

for line in sys.stdin:
  (r, x) = line.split('\t', 1)
  print x,
  c += 1
  if c == k: break