class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.z: B = None
        self.v: B = None
        self.txt = txt

d = A("d")
m = B("m")
k = C("k")
j = D("j")
b = C("b")
e = B("e")

d.r = j
d.t = m
m.o = j
m.t = j
k.s = d
k.r = b
j.t = d
j.u = d
j.z = m
j.v = e
b.s = d
b.r = k
e.o = j
e.t = j
assert j.z.o.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.z: B = None
        self.v: B = None
        self.txt = txt

d = A("d")
m = B("m")
k = C("k")
j = D("j")
b = C("b")
e = B("e")

d.r = j
d.t = m
m.o = j
m.t = j
k.s = d
k.r = b
j.t = d
j.u = d
j.z = m
j.v = e
b.s = d
b.r = k
e.o = j
e.t = j
assert j.z.o.v.o.v.txt == "e"