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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: B = None
        self.s: E = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

n = A("n")
g = B("g")
k = C("k")
a = D("a")
b = E("b")
c = C("c")
m = A("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: B = None
        self.s: E = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

n = A("n")
g = B("g")
k = C("k")
a = D("a")
b = E("b")
c = C("c")
m = A("m")

n.q = a
n.z = k
n.y = g
g.x = b
k.t = a
k.s = g
k.q = g
a.o = b
a.s = b
a.r = g
a.x = g
a.u = k
b.z = k
b.o = c
c.t = a
c.s = g
c.q = g
m.q = a
m.z = c
m.y = g
assert k.t.r.x.txt == "b"