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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.q: C = None
        self.txt = txt

l = A("l")
k = B("k")
f = C("f")
g = C("g")
b = B("b")
e = A("e")
m = A("m")
i = A("i")
d = C("d")

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.q: C = None
        self.txt = txt

l = A("l")
k = B("k")
f = C("f")
g = C("g")
b = B("b")
e = A("e")
m = A("m")
i = A("i")
d = C("d")

l.t = k
k.s = e
k.w = g
k.o = i
f.v = e
f.p = l
f.q = d
g.v = m
g.p = i
g.q = d
b.s = i
b.w = f
b.o = m
e.t = b
m.t = b
i.t = b
d.v = l
d.p = i
d.q = g
assert e.t.s.t.s.t.w.v.txt == "e"