class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.s: B = None
        self.x: C = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
k = C("k")
i = D("i")
f = B("f")
e = D("e")
n = D("n")
a = A("a")
h = B("h")

m.t = a
m.u = k
m.x = k
m.s = h
j.o = k
j.x = h
k.s = i
k.z = i
k.q = m
i.p = e
i.o = h
i.y = k
i.z = k
f.o = k
f.x = j
e.p = n
e.o = h
e.y = k
e.z = k
n.p = i
n.o = j
n.y = k
n.z = k
a.t = m
a.u = k
a.x = k
a.s = h
h.o = k
h.x = f
assert n.z.q.s.o.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.s: B = None
        self.x: C = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
k = C("k")
i = D("i")
f = B("f")
e = D("e")
n = D("n")
a = A("a")
h = B("h")

m.t = a
m.u = k
m.x = k
m.s = h
j.o = k
j.x = h
k.s = i
k.z = i
k.q = m
i.p = e
i.o = h
i.y = k
i.z = k
f.o = k
f.x = j
e.p = n
e.o = h
e.y = k
e.z = k
n.p = i
n.o = j
n.y = k
n.z = k
a.t = m
a.u = k
a.x = k
a.s = h
h.o = k
h.x = f
assert n.z.q.s.o.q.u.txt == "k"