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

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

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

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

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

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

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

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

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

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

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

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

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