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

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

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

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

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

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

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

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

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

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

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

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

j.t = a
j.u = k
l.s = e
k.s = j
a.o = m
a.p = e
m.x = k
m.q = n
m.v = e
m.r = j
m.u = l
e.s = j
n.x = e
n.q = m
n.v = k
n.r = j
n.u = l
assert k.s.t.o.txt == "m"