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

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

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

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

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

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

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

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

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

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

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