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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.t: E = None
        self.q: E = None
        self.o: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
e = C("e")
a = D("a")
l = E("l")
k = B("k")

n.q = e
n.w = e
j.r = n
j.u = k
e.s = j
a.y = j
a.s = l
a.t = l
a.q = l
a.o = k
l.o = a
k.r = n
k.u = j
assert a.y.r.w.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.t: E = None
        self.q: E = None
        self.o: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
e = C("e")
a = D("a")
l = E("l")
k = B("k")

n.q = e
n.w = e
j.r = n
j.u = k
e.s = j
a.y = j
a.s = l
a.t = l
a.q = l
a.o = k
l.o = a
k.r = n
k.u = j
assert a.y.r.w.s.u.txt == "k"