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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = 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.s: D = None
        self.p: B = None
        self.txt = txt

l = A("l")
g = B("g")
k = C("k")
j = D("j")
b = E("b")

l.z = j
l.r = j
l.u = b
g.x = l
k.s = j
k.w = g
j.w = k
b.s = j
b.p = g
assert k.w.x.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: D = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = 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.s: D = None
        self.p: B = None
        self.txt = txt

l = A("l")
g = B("g")
k = C("k")
j = D("j")
b = E("b")

l.z = j
l.r = j
l.u = b
g.x = l
k.s = j
k.w = g
j.w = k
b.s = j
b.p = g
assert k.w.x.r.w.s.txt == "j"