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

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

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

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

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

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

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

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

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

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

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

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

j.p = e
j.w = c
j.r = m
j.x = n
a.t = j
e.t = n
e.v = a
e.q = m
e.y = j
n.y = e
c.r = n
c.z = a
c.y = a
c.o = e
c.t = i
m.y = e
i.r = m
i.z = a
i.y = a
i.o = e
i.t = c
assert m.y.y.x.txt == "n"