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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: E = None
        self.q: C = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.q: A = None
        self.txt = txt

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

m.z = a
m.t = k
j.u = a
j.t = a
k.v = a
k.s = a
k.q = d
k.t = g
a.z = k
a.q = k
a.y = g
a.t = g
g.p = k
g.v = n
g.q = d
n.p = k
n.v = g
n.q = m
e.u = a
e.t = a
f.z = a
f.t = k
d.z = a
d.t = k
assert m.t.q.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: E = None
        self.q: C = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.q: A = None
        self.txt = txt

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

m.z = a
m.t = k
j.u = a
j.t = a
k.v = a
k.s = a
k.q = d
k.t = g
a.z = k
a.q = k
a.y = g
a.t = g
g.p = k
g.v = n
g.q = d
n.p = k
n.v = g
n.q = m
e.u = a
e.t = a
f.z = a
f.t = k
d.z = a
d.t = k
assert m.t.q.z.y.txt == "g"