Now I get it. Thanks !
Here’s a more pythonic code golf:
for _ in xrange(input()): X, Y, K, N = map(int, raw_input().split()) print ["UnluckyChef", "LuckyChef"][any(P >= X - Y and C <= K for P, C in [map(int, raw_input().strip().split()) for i in xrange(N)])]
When you post code, you should try indenting all your code four spaces, so that it renders properly as code.
because you are breaking the loop after getting result. you are not collecting all the input data. hence getting the wrong answer. remove break statement and you would get the correct answer.
i get a wrong answer when i use this snippet to take an integer input
int c = gc();
int x = 0;
for (; (c>47 && c<58); c=gc())
x = x *10 + c - 48;
but when i used cin instead of this snippet my solution gets accepted.