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

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

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

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

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

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

i.r = l
i.u = n
n.t = m
n.q = m
n.o = l
m.o = k
m.p = i
l.w = m
k.u = m
assert l.w.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

i.r = l
i.u = n
n.t = m
n.q = m
n.o = l
m.o = k
m.p = i
l.w = m
k.u = m
assert l.w.o.u.txt == "m"