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

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

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

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

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

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

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

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

i.v = e
d.x = c
d.z = n
l.v = n
l.p = n
l.w = d
e.v = i
c.v = l
c.p = n
c.w = d
n.v = l
n.p = c
n.w = d
assert c.v.w.z.txt == "n"