class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: D = None
        self.w: E = None
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

h = A("h")
k = B("k")
n = C("n")
e = D("e")
m = E("m")
c = E("c")
f = D("f")
g = A("g")
a = A("a")

h.q = k
h.w = g
h.t = m
k.w = c
n.p = e
n.r = e
n.w = c
n.z = k
e.x = a
m.s = g
c.s = a
f.x = a
g.q = k
g.w = a
g.t = m
a.q = k
a.w = g
a.t = m
assert e.x.q.w.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: D = None
        self.w: E = None
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

h = A("h")
k = B("k")
n = C("n")
e = D("e")
m = E("m")
c = E("c")
f = D("f")
g = A("g")
a = A("a")

h.q = k
h.w = g
h.t = m
k.w = c
n.p = e
n.r = e
n.w = c
n.z = k
e.x = a
m.s = g
c.s = a
f.x = a
g.q = k
g.w = a
g.t = m
a.q = k
a.w = g
a.t = m
assert e.x.q.w.s.t.txt == "m"