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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: A = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: A = None
        self.t: E = None
        self.txt = txt

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

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

e.o = c
e.q = m
m.s = n
c.p = d
c.x = e
k.q = n
k.t = n
k.y = e
n.t = d
d.q = n
d.t = n
d.y = e
assert e.o.p.q.txt == "n"