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

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: E = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: E = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

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

n.p = a
k.o = j
k.t = m
m.q = n
m.p = c
m.z = j
j.w = a
j.q = a
j.v = c
j.o = c
c.x = n
c.u = m
c.t = j
c.o = k
c.w = k
a.w = j
a.q = j
a.v = c
a.o = c
assert c.t.v.x.txt == "n"