YangQiShaoNian is a fan of data structures. After studying the course $\sf CMU 15-445$ $\sf Introduction$ $\sf to$ $\sf Database$ $\sf Systems$, he decided to lead you in front of the screen to create a simple SQL statement executor.
This database can be abstracted as a table with a variable number of rows and exactly $n$ columns.
Each column of the table has a unique field name, and the field names are all different.
You will need to handle various types of SQL statements. The statement formats are as follows:
**1\. SQL Statements**
**1.1.** $\tt insert$ **Statement**
**Syntax**
$\tt insert($field value$1,$field value$2,\dots ,$field value$n\tt)$
**Explanation**
Inserts a new record into the table, which has exactly $n$ parameters. The $i$\-th parameter represents the value of the $i$\-th field, and each parameter is a string. The string contains only lowercase and uppercase letters, numbers, and underscores.
**Example**
If the table is currently:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722624979054/90366B69F7AB1FF4C0EAB5B70F3F1197)
After executing $\tt insert(c,Yangqishaonian,Nowcoder)$, the table becomes:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625008384/99A6C3DF67B62A4397DFB07E00DBE862)
**1.2.** $\tt select$ **Statement**
**Syntax**
$\tt select($output field name$\tt ,$condition field name$\tt ,$condition value$)$
**Explanation**
The output field name and condition field name are among the given $n$ field names.
The condition value is a string. The string contains only lowercase and uppercase letters, numbers, and underscores.
For a certain data, if its condition field is equal to the condition value, then add the corresponding data item of this data to the returned set.
**Return Value**
The result of the query is a sorted set of strings, sorted in the order of insertion.
**Example**
If the table is currently:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625028416/76AF666831FD6F13DBD3E826D948411C)
At this time, the return value of $\tt select(name, birth\_place,Beijing)$ is a set of $2$ strings, where the first string is $\tt Alice$ and the second string is $\tt Bob$.
**1.3.** $\tt delete$ **Statement**
**Syntax**
$\tt delete($condition field name$\tt ,$ condition value$\tt )$
**Explanation**
The condition field name is among the given $n$ field names.
The condition value is a string. The string contains only lowercase and uppercase letters, numbers, and underscores.
For a certain data, if its condition field is equal to the condition value, then it is deleted.
**Example**
If the table is currently:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625049337/AD320F0EA152EE5E2C0EBA60F25B54D2)
After executing $\tt delete(birth\_place,Beijing)$, the table becomes:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625062622/9EEF4F3203A473D145E6EE9DD26E5255)
**1.4.** $\tt select\_in$ **Statement**
**Syntax**
$\tt select\_in($output field name$\tt ,$condition field name$\tt ,$condition value set$\tt )$
**Explanation**
The output field name and condition field name are among the given $n$ field names.
The condition value set is a set of strings.
For a certain data, if its condition field appears in the condition value set, then add the corresponding data item of this data to the returned set.
**Return Value**
The result of the query is a sorted set of strings, sorted in the order of insertion.
**Note**
For the third parameter, it can only nest $\tt select$ or $\tt select\_in$ statements.
**Example**
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625076366/21361DDEB783C0CC5F7CB9463C83F61F)
The return value of $\tt select\_in(D,A,select(B,C,2))$ is a set of $2$ strings, where the first string is $\tt x$ and the second string is $\tt z$.
**1.5.** $\tt delete\_in$ **Statement**
**Syntax**
$\tt delete\_in($condition field name$\tt ,$condition value set$\tt )$
**Explanation**
The condition field name is among the given $n$ field names.
The condition value set is a set of strings.
For a certain data, if its condition field appears in the condition value set, then it is deleted.
**Note**
For the second parameter, it can only nest $\tt select$ or $\tt select\_in$ statements.
**Example**
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625090663/E8F044B435A9712ACD518B21B7E22487)
After executing $\tt delete\_in(A,select(B,C,2))$, the table becomes:
![](https://uploadfiles.nowcoder.com/images/20240803/0_1722625102498/A752CD8651207E3ECA606B2E7FBE4FEF)
**2\. Transaction Statements**
In the database, each SQL statement must **belong to exactly one transaction**.
The format of each transaction is as follows:
1. $\tt begin()$ Statement --- Indicates the start of a transaction
2. Several SQL statements... --- All these SQL statements belong to the current transaction
3. $\tt commit()$ Statement or $\tt abort()$ Statement --- Indicates the end of a transaction
The next three subsections will introduce the three types of statements mentioned above.
**2.1.** $\tt begin$ **Statement**
**Syntax**
$\tt begin()$
**Explanation**
Indicates the start of a new database transaction, and the first statement must be $\tt begin()$.
Next, several (or $0$) SQL statements will be given.
All SQL statements before the next $\tt commit()$ or $\tt abort()$ statement belong to this transaction.
It is guaranteed that the next **transaction statement** must be $\tt commit()$ or $\tt abort()$.
**2.2.** $\tt commit$ **Statement**
**Syntax**
$\tt commit()$
**Explanation**
All changes to the database caused by the SQL statements between the previous $\tt begin()$ statement and this statement need to be preserved.
If this statement is not the last statement, it is guaranteed that the next statement must be $\tt begin()$.
**2.3.** $\tt abort$ **Statement**
**Syntax**
$\tt abort()$
**Explanation**
All changes to the database caused by the SQL statements between the previous $\tt begin()$ statement and this statement need to be discarded.
If this statement is not the last statement, it is guaranteed that the next statement must be $\tt begin()$.