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

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

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

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

c = A("c")
k = B("k")
a = C("a")
l = D("l")
i = D("i")
h = B("h")
n = D("n")
m = C("m")

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

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

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

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

c = A("c")
k = B("k")
a = C("a")
l = D("l")
i = D("i")
h = B("h")
n = D("n")
m = C("m")

c.z = n
c.t = i
k.q = h
a.o = c
a.p = m
a.t = l
l.p = i
l.w = m
l.y = m
l.s = a
i.p = n
i.w = a
i.y = a
i.s = m
h.q = k
n.p = l
n.w = m
n.y = m
n.s = m
m.o = c
m.p = a
m.t = n
assert m.p.p.o.txt == "c"