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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: E = None
        self.p: A = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: E = None
        self.p: A = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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