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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: E = None
        self.v: B = None
        self.t: A = None
        self.x: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.y: A = None
        self.p: A = None
        self.q: C = None
        self.txt = txt

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

k.y = d
i.s = m
i.q = m
i.v = c
i.t = k
i.x = g
d.t = k
d.s = i
g.z = k
m.z = d
m.q = d
m.r = g
m.y = k
m.p = k
c.s = m
c.q = m
c.v = i
c.t = k
c.x = g
assert k.y.s.x.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: E = None
        self.v: B = None
        self.t: A = None
        self.x: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.y: A = None
        self.p: A = None
        self.q: C = None
        self.txt = txt

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

k.y = d
i.s = m
i.q = m
i.v = c
i.t = k
i.x = g
d.t = k
d.s = i
g.z = k
m.z = d
m.q = d
m.r = g
m.y = k
m.p = k
c.s = m
c.q = m
c.v = i
c.t = k
c.x = g
assert k.y.s.x.z.y.txt == "d"