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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: E = None
        self.s: D = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
g = C("g")
f = D("f")
k = E("k")
c = E("c")
j = B("j")
l = E("l")

d.w = f
i.z = g
g.t = c
g.y = l
g.s = f
f.s = g
k.r = j
c.r = i
j.z = g
l.r = j
assert l.r.z.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: E = None
        self.s: D = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
g = C("g")
f = D("f")
k = E("k")
c = E("c")
j = B("j")
l = E("l")

d.w = f
i.z = g
g.t = c
g.y = l
g.s = f
f.s = g
k.r = j
c.r = i
j.z = g
l.r = j
assert l.r.z.y.r.txt == "j"