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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

i = A("i")
a = B("a")
l = C("l")
j = A("j")
g = C("g")
e = A("e")
c = B("c")

i.z = a
i.w = l
a.r = c
a.o = l
l.u = j
j.z = a
j.w = l
g.u = i
e.z = a
e.w = g
c.r = a
c.o = l
assert l.u.z.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

i = A("i")
a = B("a")
l = C("l")
j = A("j")
g = C("g")
e = A("e")
c = B("c")

i.z = a
i.w = l
a.r = c
a.o = l
l.u = j
j.z = a
j.w = l
g.u = i
e.z = a
e.w = g
c.r = a
c.o = l
assert l.u.z.r.r.txt == "a"