class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: E = None
        self.r: B = None
        self.z: A = None
        self.txt = txt

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

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

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

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

b = A("b")
c = B("c")
m = C("m")
n = D("n")
i = E("i")
f = D("f")
e = B("e")
k = A("k")

b.q = e
b.u = i
b.r = c
b.z = k
c.p = n
c.s = n
m.p = k
n.q = c
i.u = m
i.o = c
f.q = e
e.p = f
e.s = f
k.q = c
k.r = c
k.u = i
k.z = b
assert k.u.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: E = None
        self.r: B = None
        self.z: A = None
        self.txt = txt

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

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

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

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

b = A("b")
c = B("c")
m = C("m")
n = D("n")
i = E("i")
f = D("f")
e = B("e")
k = A("k")

b.q = e
b.u = i
b.r = c
b.z = k
c.p = n
c.s = n
m.p = k
n.q = c
i.u = m
i.o = c
f.q = e
e.p = f
e.s = f
k.q = c
k.r = c
k.u = i
k.z = b
assert k.u.o.p.txt == "n"