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

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

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

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

c.z = d
c.x = d
l.w = f
n.z = l
n.y = e
n.x = e
f.z = l
f.y = e
f.x = n
d.z = c
d.x = c
e.z = l
e.y = f
e.x = f
assert n.x.y.y.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: A = None
        self.txt = txt

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

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

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

c.z = d
c.x = d
l.w = f
n.z = l
n.y = e
n.x = e
f.z = l
f.y = e
f.x = n
d.z = c
d.x = c
e.z = l
e.y = f
e.x = f
assert n.x.y.y.z.w.z.txt == "l"