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

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

e = A("e")
h = B("h")
l = B("l")
m = A("m")
g = A("g")
f = B("f")
b = B("b")
a = B("a")
k = A("k")
d = A("d")

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

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

e = A("e")
h = B("h")
l = B("l")
m = A("m")
g = A("g")
f = B("f")
b = B("b")
a = B("a")
k = A("k")
d = A("d")

e.t = b
e.v = b
h.w = b
h.s = a
l.w = b
l.s = a
m.t = h
m.v = h
g.t = a
g.v = f
f.w = l
f.s = h
b.w = l
b.s = l
a.w = h
a.s = l
k.t = h
k.v = l
d.t = a
d.v = a
assert h.w.w.w.s.txt == "l"