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

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

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

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

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

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

c.p = k
c.w = k
c.s = g
c.z = g
c.x = f
d.v = k
g.s = d
f.s = d
f.u = g
k.r = d
k.v = d
k.y = g
assert k.r.v.y.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: C = None
        self.z: C = None
        self.w: E = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

c.p = k
c.w = k
c.s = g
c.z = g
c.x = f
d.v = k
g.s = d
f.s = d
f.u = g
k.r = d
k.v = d
k.y = g
assert k.r.v.y.s.v.txt == "k"