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

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

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

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

a = A("a")
f = B("f")
e = C("e")
j = D("j")
k = B("k")

a.t = e
a.v = j
a.q = j
a.o = f
f.z = j
f.p = j
e.o = a
e.r = a
e.y = f
e.z = j
j.x = f
j.v = f
j.r = a
j.o = e
k.z = j
k.p = j
assert f.p.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: D = None
        self.o: B = None
        self.q: D = None
        self.txt = txt

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

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

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

a = A("a")
f = B("f")
e = C("e")
j = D("j")
k = B("k")

a.t = e
a.v = j
a.q = j
a.o = f
f.z = j
f.p = j
e.o = a
e.r = a
e.y = f
e.z = j
j.x = f
j.v = f
j.r = a
j.o = e
k.z = j
k.p = j
assert f.p.o.z.txt == "j"