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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: E = None
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

f.s = k
j.z = k
j.y = k
j.x = c
a.w = l
c.x = f
k.t = c
k.q = j
k.w = a
l.z = k
l.y = k
l.x = c
assert k.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: E = None
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

f.s = k
j.z = k
j.y = k
j.x = c
a.w = l
c.x = f
k.t = c
k.q = j
k.w = a
l.z = k
l.y = k
l.x = c
assert k.w.w.y.txt == "k"