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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

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

n.o = k
n.s = k
n.q = a
a.x = n
a.v = n
a.o = m
a.y = c
c.q = k
k.r = a
k.p = a
k.s = m
k.v = n
m.t = n
m.p = k
m.o = a
assert k.p.y.q.v.s.txt == "k"