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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.v: C = None
        self.p: C = None
        self.txt = txt

c = A("c")
f = B("f")
i = C("i")
d = D("d")
n = E("n")
k = E("k")
e = D("e")
b = B("b")

c.w = i
c.y = e
f.y = k
f.r = k
i.x = k
d.s = i
d.p = i
d.w = c
d.x = e
n.t = f
n.s = b
n.v = i
n.p = i
k.t = f
k.s = f
k.v = i
k.p = i
e.s = i
e.p = i
e.w = c
e.x = d
b.y = k
b.r = k
assert c.y.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.v: C = None
        self.p: C = None
        self.txt = txt

c = A("c")
f = B("f")
i = C("i")
d = D("d")
n = E("n")
k = E("k")
e = D("e")
b = B("b")

c.w = i
c.y = e
f.y = k
f.r = k
i.x = k
d.s = i
d.p = i
d.w = c
d.x = e
n.t = f
n.s = b
n.v = i
n.p = i
k.t = f
k.s = f
k.v = i
k.p = i
e.s = i
e.p = i
e.w = c
e.x = d
b.y = k
b.r = k
assert c.y.w.w.txt == "i"