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

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

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

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

i = A("i")
n = B("n")
m = C("m")
a = D("a")
k = B("k")
d = D("d")

i.o = k
i.w = d
n.q = m
m.z = n
m.t = d
m.o = k
m.y = a
a.y = k
a.q = k
a.t = d
k.q = m
d.y = k
d.q = k
d.t = a
assert a.y.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: D = None
        self.txt = txt

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

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

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

i = A("i")
n = B("n")
m = C("m")
a = D("a")
k = B("k")
d = D("d")

i.o = k
i.w = d
n.q = m
m.z = n
m.t = d
m.o = k
m.y = a
a.y = k
a.q = k
a.t = d
k.q = m
d.y = k
d.q = k
d.t = a
assert a.y.q.o.txt == "k"