#C10880. Custom List Manager

    ID: 40134 Type: Default 1000ms 256MiB

Custom List Manager

Custom List Manager

You are given a series of commands to manage a list of unique integers. The commands allow you to insert, delete, check for presence, and print the list in sorted order.

The commands are as follows:

  • Insert x: Insert the integer x into the list. If x is already in the list, do nothing.
  • Delete x: Delete the integer x from the list. If x is not in the list, do nothing.
  • Check x: If the integer x is in the list, output YES; otherwise, output NO.
  • Print: Print all integers in the list in increasing order, separated by a single space. If the list is empty, print an empty line.

You need to process the commands one by one and produce an output for each Check and Print command.

Note: The list should always maintain unique elements.

Mathematical Note: If we denote the set of numbers by \( S \), then insert means \( S = S \cup \{x\} \) and delete means \( S = S \setminus \{x\} \).

inputFormat

The first line contains an integer N (the number of commands).

Each of the next N lines contains one command. Each command is one of the following forms:

  • Insert x
  • Delete x
  • Check x
  • Print

Here, x is an integer.

outputFormat

For every Check command, output a line with either YES or NO.

For every Print command, output a line with all current numbers in the list sorted in increasing order separated by a single space. If the list is empty, output an empty line.

## sample
2
Insert 1
Print
1

</p>