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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: B = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

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

m = A("m")
b = B("b")
e = C("e")
k = D("k")
c = A("c")
n = C("n")
a = A("a")
h = D("h")

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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: B = None
        self.s: A = None
        self.v: C = None
        self.txt = txt

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

m = A("m")
b = B("b")
e = C("e")
k = D("k")
c = A("c")
n = C("n")
a = A("a")
h = D("h")

m.t = n
m.o = c
m.s = b
m.y = a
b.r = m
b.q = h
b.v = k
b.t = n
e.p = n
e.v = n
e.z = b
e.s = m
k.x = n
k.t = e
c.t = n
c.o = m
c.s = b
c.y = a
n.p = e
n.v = e
n.z = b
n.s = c
a.t = e
a.o = c
a.s = b
a.y = m
h.x = e
h.t = e
assert b.v.t.v.s.t.txt == "n"