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

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

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

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

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

k = A("k")
h = B("h")
m = C("m")
b = D("b")
a = E("a")

k.x = h
k.v = h
k.o = h
k.u = h
h.q = k
m.v = b
m.r = k
m.y = a
b.y = k
a.q = m
assert m.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: B = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

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

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

k = A("k")
h = B("h")
m = C("m")
b = D("b")
a = E("a")

k.x = h
k.v = h
k.o = h
k.u = h
h.q = k
m.v = b
m.r = k
m.y = a
b.y = k
a.q = m
assert m.v.y.v.txt == "h"