# hw10-3-1(SQLServer)
好像有點偷作弊但就這樣ㄅ
```python=
def ops(o1,o2,o3):
if o2 == '<':return o1 < o3
elif o2 == '>':return o1 > o3
elif o2 == '==':return o1 == o3
elif o2 == '!=':return o1 != o3
def s(i,o):
if o =='salary':return i.salary
elif o == 'lastname':return i.lastname
elif o == 'firstname':return i.firstname
elif o == 'ID':return i.ID
elif o == 'age':return i.age
class data:
def __init__(self,lastname = '',firstname = '',ID = '',salary= 0,age = 0):
self.lastname = lastname
self.firstname = firstname
self.ID = ID
self.salary= salary
self.age = age
class SQLServer:
addli =[]; selectli = []
def addGuest(self,doct):
dd = doct.split(' ')
x = data(*dd)
SQLServer.addli.append(x)
def selectGuest(self,sel):
smalli =[]
selc = sel.split('where')
con = selc[0].split(' ')[1:-1]
op = selc[1].split(' ')[1:]
for i in SQLServer.addli:
if ops(s(i,op[0]),op[1],op[2]):
sli = []
for j in con:
sli.append(s(i,j))
smalli.append(sli)
SQLServer.selectli.append(smalli)
S = SQLServer()
for _ in range(int(input())):
S.addGuest(input())
for _ in range(int(input())):
S.selectGuest(input())
for i in SQLServer.selectli:
for j in i:
print(' '.join(j))
```