S-expressions are a tree, not the other way around. Your example formatted with newlines:
(f 1
(g 2)
3)
It represents the following cons tree:
+---+---+ +---+---+ +---+---+ +---+---+
--->| f | ----->| 1 | ----->| ¦ | ----->| 3 |NIL|
+---+---+ +---+---+ + ¦ +---+ +---+---+
v
+---+---+ +---+---+
| g | ----->| 2 |NIL|
+---+---+ +---+---+
— , .
- , . Emacs paredit-mode, , .