class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: C = None
        self.t: E = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: C = None
        self.o: C = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

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

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

k.x = m
k.u = m
k.w = b
k.t = f
g.s = a
n.q = b
n.w = b
n.o = b
n.y = b
n.x = g
a.q = b
f.w = a
f.s = g
d.w = a
d.s = g
b.q = n
b.w = n
b.o = n
b.y = n
b.x = g
m.x = k
m.u = k
m.w = n
m.t = f
assert a.q.x.s.q.x.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: C = None
        self.t: E = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: C = None
        self.o: C = None
        self.x: B = None
        self.y: C = None
        self.txt = txt

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

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

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

k.x = m
k.u = m
k.w = b
k.t = f
g.s = a
n.q = b
n.w = b
n.o = b
n.y = b
n.x = g
a.q = b
f.w = a
f.s = g
d.w = a
d.s = g
b.q = n
b.w = n
b.o = n
b.y = n
b.x = g
m.x = k
m.u = k
m.w = n
m.t = f
assert a.q.x.s.q.x.s.q.txt == "b"