Question 35: 
Consider a database table, Emails, which has the attributes First Name and Email ID. Given  rows of data simulating the Emails table, print an alphabetically-ordered list of people whose email address ends in .

Sample Input

6
riya riya@gmail.com
julia julia@julia.me
julia sjulia@gmail.com
julia julia@gmail.com
samantha samantha@gmail.com
tanya tanya@gmail.com

Sample Output

julia
julia
riya
samantha
tanya


#!/bin/python3

import math
import os
import random
import re
import sys



if __name__ == '__main__':
    N = int(input())
    l=[]

    for N_itr in range(N):
        firstNameEmailID = input().split()

        firstName = firstNameEmailID[0]

        emailID = firstNameEmailID[1]
        if(firstName.islower() and emailID.islower()):
            i1=0
            for i in range(len(emailID)):
                if(emailID[i]=='@'):
                    i1=i
            s=""
            s1=""
                    
            for j in range(i1+1,len(emailID)):
                s+=emailID[j]
            if(s=="gmail.com"):
                l.append(firstName)
    l.sort()
    for i in l:
        print(i)