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

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

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

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

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

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

b.q = i
b.x = c
b.y = n
k.v = m
k.t = m
k.o = b
n.o = c
n.u = c
n.y = b
n.x = m
m.x = c
c.z = n
i.v = m
i.t = m
i.o = b
e.q = k
e.x = c
e.y = n
assert m.x.z.x.x.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: E = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

b.q = i
b.x = c
b.y = n
k.v = m
k.t = m
k.o = b
n.o = c
n.u = c
n.y = b
n.x = m
m.x = c
c.z = n
i.v = m
i.t = m
i.o = b
e.q = k
e.x = c
e.y = n
assert m.x.z.x.x.z.o.txt == "c"