# Help with Intervals

Time Limit: 6000MS

Memory Limit: 131072K

## Description

LogLoader, Inc. is a company specialized in providing products for analyzing logs. While Ikki is working on graduation design, he is also engaged in an internship at LogLoader. Among his tasks, one is to write a module for manipulating time intervals, which have confused him a lot. Now he badly needs your help.In discrete mathematics, you have studied several basic set operations, namely union, intersection, relative complementation and symmetric difference, which naturally apply to the specialization of sets as intervals.. For your quick reference they are summarized in the table below:
OperationNotationDefinition
UnionAB{x : xA or xB}
IntersectionAB{x : xA and xB}
Relative complementationAB{x : xA but B}
Symmetric differenceAB(AB) ∪ (BA)
Ikki has abstracted the interval operations emerging from his job as a tiny programming language. He wants you to implement an interpreter for him. The language maintains a set S, which starts out empty and is modified as specified by the following commands:
CommandSemantics
U TSST
I TSST
D TSST
C TSTS
S TSST

## Input

The input contains exactly one test case, which consists of between 0 and 65,535 (inclusive) commands of the language. Each command occupies a single line and appears like
X T
where X is one of ‘U’, ‘I’, ‘D’, ‘C’ and ‘S’ and T is an interval in one of the forms (a,b), (a,b], [a,b) and [a,b] (a, bZ, 0 ≤ ab ≤ 65,535), which take their usual meanings. The commands are executed in the order they appear in the input.End of file (EOF) indicates the end of input.

## Output

Output the set S as it is after the last command is executed as the union of a minimal collection of disjoint intervals. The intervals should be printed on one line separated by single spaces and appear in increasing order of their endpoints. If S is empty, just print “empty set” and nothing else.

## Sample Input

U [1,5]
D [3,3]
S [2,4]
C (1,5)
I (2,3]

## Sample Output

(2,3)

N/A