Querying a phone directory until end of input is reached
Take care to adhere to PEP 8 code formatting guidelines.  In particular, there should be a space before and after each = and +.  The KeyError handler should have just one level of indentation.

The phonebook could be constructed using a one-liner.  I consider it good practice to specify maxsplit=1, though it makes no practical difference when you are assured that the input will be well formed.

Getting the rest of the input using for line in sys.stdin is not a bad approach, I think.

import sys

n = int(input())
phonebook = dict(input().split(maxsplit=1) for _ in range(n))
for line in sys.stdin:
    key = line.strip('\n')
    try:
        print('{0}={1}'.format(key, phonebook[key]))
    except KeyError:
        print('Not found')