• + 0 comments
    import re
    
    for i in range(int(input())):
        s = input()
        matches = re.findall(r"[.:\s](#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3})", s)
        if matches:
            print(*matches, sep="\n")