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

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

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

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

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

j = A("j")
b = B("b")
d = C("d")
i = D("i")
m = E("m")
c = D("c")
n = A("n")

j.p = d
j.u = n
j.o = m
j.y = b
b.u = j
b.o = i
d.t = c
i.q = d
m.t = i
m.q = b
m.w = b
m.x = n
m.o = c
c.q = d
n.p = d
n.u = j
n.o = m
n.y = b
assert m.t.q.t.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.o: E = None
        self.y: B = None
        self.txt = txt

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

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

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

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

j = A("j")
b = B("b")
d = C("d")
i = D("i")
m = E("m")
c = D("c")
n = A("n")

j.p = d
j.u = n
j.o = m
j.y = b
b.u = j
b.o = i
d.t = c
i.q = d
m.t = i
m.q = b
m.w = b
m.x = n
m.o = c
c.q = d
n.p = d
n.u = j
n.o = m
n.y = b
assert m.t.q.t.q.t.txt == "c"