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

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

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

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

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

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

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

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

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

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

d.w = e
d.r = e
e.o = j
e.r = j
e.t = j
e.s = k
j.o = k
j.p = e
j.y = d
j.u = a
a.o = e
a.z = e
a.v = d
k.o = e
k.z = e
k.v = d
assert k.v.r.t.u.z.txt == "e"