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

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

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

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

d = A("d")
a = B("a")
j = C("j")
f = D("f")
i = C("i")

d.p = f
d.z = f
d.v = f
d.o = f
a.q = d
j.r = i
j.y = i
j.v = a
f.w = j
i.r = j
i.y = j
i.v = a
assert a.q.z.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: D = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

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

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

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

d = A("d")
a = B("a")
j = C("j")
f = D("f")
i = C("i")

d.p = f
d.z = f
d.v = f
d.o = f
a.q = d
j.r = i
j.y = i
j.v = a
f.w = j
i.r = j
i.y = j
i.v = a
assert a.q.z.w.y.txt == "i"