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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.t: D = None
        self.w: C = 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.z: B = None
        self.r: A = None
        self.txt = txt

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

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

l.o = k
k.y = j
k.o = n
k.w = n
k.t = a
n.o = j
a.z = k
a.r = l
j.r = a
assert a.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: C = None
        self.t: D = None
        self.w: C = 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.z: B = None
        self.r: A = None
        self.txt = txt

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

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

l.o = k
k.y = j
k.o = n
k.w = n
k.t = a
n.o = j
a.z = k
a.r = l
j.r = a
assert a.z.t.z.txt == "k"