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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.x: A = None
        self.o: B = None
        self.txt = txt

f = A("f")
d = B("d")
i = C("i")
c = D("c")
l = B("l")

f.w = c
d.s = i
d.p = i
i.v = l
i.p = c
i.z = c
c.t = i
c.p = l
c.x = f
c.o = d
l.s = i
l.p = i
assert c.t.v.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: B = None
        self.x: A = None
        self.o: B = None
        self.txt = txt

f = A("f")
d = B("d")
i = C("i")
c = D("c")
l = B("l")

f.w = c
d.s = i
d.p = i
i.v = l
i.p = c
i.z = c
c.t = i
c.p = l
c.x = f
c.o = d
l.s = i
l.p = i
assert c.t.v.s.p.txt == "c"