1# Hex Color Code in Python - Hacker Rank Solution
2# Python 3
3# Enter your code here. Read input from STDIN. Print output to STDOUT
4# Hex Color Code in Python - Hacker Rank Solution START
5import re
6
7T = int(input())
8in_css = False
9for _ in range(T):
10 s = input()
11 if '{' in s:
12 in_css = True
13 elif '}' in s:
14 in_css = False
15 elif in_css:
16 for color in re.findall('#[0-9a-fA-F]{3,6}', s):
17 print(color)
18# Hex Color Code in Python - Hacker Rank Solution END
19