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

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

class C:
    def __init__(self, txt: str):
        self.o: E = 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.x: A = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

n.o = h
n.u = k
i.s = a
i.x = a
i.q = a
m.o = k
h.x = k
k.x = b
k.s = n
k.u = n
l.x = n
l.s = n
l.u = n
a.s = i
a.x = i
a.q = i
b.o = h
b.u = k
assert b.o.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = 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.x: A = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

n.o = h
n.u = k
i.s = a
i.x = a
i.q = a
m.o = k
h.x = k
k.x = b
k.s = n
k.u = n
l.x = n
l.s = n
l.u = n
a.s = i
a.x = i
a.q = i
b.o = h
b.u = k
assert b.o.x.u.txt == "n"