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

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

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

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

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

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

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

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

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

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

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

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

b.s = m
b.w = e
b.t = d
g.s = e
g.q = e
g.p = k
g.x = k
e.x = k
e.q = m
e.y = b
e.o = g
a.p = b
a.z = k
a.t = e
a.x = e
k.o = c
c.s = e
c.q = e
c.p = k
c.x = k
d.p = b
d.z = k
d.t = e
d.x = e
m.s = e
m.q = e
m.p = k
m.x = k
assert g.p.o.s.q.txt == "m"