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

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

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

e = A("e")
f = B("f")
d = C("d")
n = B("n")
l = A("l")
a = B("a")
j = A("j")

e.y = n
e.z = j
f.r = a
d.t = l
d.u = l
d.w = e
n.r = a
l.y = f
l.z = j
a.r = f
j.y = n
j.z = e
assert l.z.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
d = C("d")
n = B("n")
l = A("l")
a = B("a")
j = A("j")

e.y = n
e.z = j
f.r = a
d.t = l
d.u = l
d.w = e
n.r = a
l.y = f
l.z = j
a.r = f
j.y = n
j.z = e
assert l.z.z.y.txt == "n"