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

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.txt = txt

i = A("i")
d = B("d")
b = C("b")
l = B("l")
j = A("j")
e = B("e")
g = C("g")

i.t = g
i.y = b
i.w = l
d.o = l
b.z = g
b.r = g
l.o = e
j.t = b
j.y = g
j.w = e
e.o = d
g.z = b
g.r = b
assert l.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: C = None
        self.txt = txt

i = A("i")
d = B("d")
b = C("b")
l = B("l")
j = A("j")
e = B("e")
g = C("g")

i.t = g
i.y = b
i.w = l
d.o = l
b.z = g
b.r = g
l.o = e
j.t = b
j.y = g
j.w = e
e.o = d
g.z = b
g.r = b
assert l.o.o.o.o.o.o.o.txt == "e"