Q1
x = 6
1: a#g(2)
2: a#f(3)

Q2
x = 9
1: a#g(2)
2: b#f(3)