import re
for _ in range(int(input())):
line = input()
#regex = re.compile('((?<=a\shref=").*(?=\"\>))(?:\"\>)(.*(?=\<\/a\>))')
regex = re.compile('((?<=a\shref=")[\d\w\/\$\-\_\.\+\!\*\'\(\)\,\:]*)(?:.*\"\>)(.*(?=\<\/a\>))')
result = re.search(regex,line)
if (result):
print(result.group(1)+','+result.group(2))
#Need to look at a "match everything until you find a '"' character' statement. Trying to account for all the \w\d\randomchar is silly
'<a href="(.*?)".*?>([^>]+)(?=</)'
New regex that is improved - not sure why this is failing and under what test cases