• + 0 comments
    import re
    
    n = int(input())
    
    for _ in range(n):
        
        line = input()
    
        line = re.sub(r'(?<= )&&(?= )', 'and', line)
    
        line = re.sub(r'(?<= )\|\|(?= )', 'or', line)
        
        print(line)