class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: B = None
        self.txt = txt

l = A("l")
d = B("d")
a = B("a")
n = A("n")
j = A("j")
e = A("e")
m = B("m")
g = A("g")
h = A("h")
b = A("b")

l.s = d
l.t = d
d.w = a
d.u = a
a.w = d
a.u = d
n.s = a
n.t = m
j.s = a
j.t = m
e.s = m
e.t = d
m.w = a
m.u = a
g.s = d
g.t = m
h.s = a
h.t = m
b.s = d
b.t = d
assert g.t.u.u.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: B = None
        self.txt = txt

l = A("l")
d = B("d")
a = B("a")
n = A("n")
j = A("j")
e = A("e")
m = B("m")
g = A("g")
h = A("h")
b = A("b")

l.s = d
l.t = d
d.w = a
d.u = a
a.w = d
a.u = d
n.s = a
n.t = m
j.s = a
j.t = m
e.s = m
e.t = d
m.w = a
m.u = a
g.s = d
g.t = m
h.s = a
h.t = m
b.s = d
b.t = d
assert g.t.u.u.w.w.txt == "d"