string_cards = input()
list_cards = string_cards.split(':')
deck = []
while True:
command = input()
if command == 'Ready':
break
command_list = command.split()
if command_list[0] == 'Add':
if command_list[1] in list_cards:
deck.append(command_list[1])
list_cards.remove(command_list[1])
else:
print("Card not found.")
elif command_list[0] == 'Insert':
if int(command_list[2]) >= len(deck):
print('Error!')
elif command_list[1] in list_cards:
deck.insert(int(command_list[2]), command_list[1])
else:
print('Error!')
elif command_list[0] == 'Remove':
if command_list[1] in deck:
deck.remove(command_list[1])
else:
print("Card not found.")
elif command_list[0] == 'Swap':
index1 = None
index2 = None
for i in range(len(deck)):
if deck[i] == command_list[1]:
index1 = i
elif deck[i] == command_list[2]:
index2 = i
deck[index1], deck[index2] = deck[index2], deck[index1]
elif command == 'Shuffle deck':
deck = deck[::-1]
print(*deck)
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}