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

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

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

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

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

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

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

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

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

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

m.x = b
m.t = k
m.s = c
k.p = n
c.z = e
h.s = c
h.x = b
h.q = i
h.v = e
b.x = m
b.t = i
b.s = c
n.s = e
n.v = e
n.x = m
n.q = i
i.p = n
e.z = c
assert h.s.z.z.z.z.z.z.txt == "c"