class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

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

g.s = h
d.z = h
c.z = g
c.q = g
c.w = g
c.v = e
f.p = k
f.s = k
f.z = d
f.x = e
h.w = d
e.p = k
e.s = k
e.z = d
e.x = f
k.z = g
k.q = g
k.w = g
k.v = e
assert c.v.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

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

g.s = h
d.z = h
c.z = g
c.q = g
c.w = g
c.v = e
f.p = k
f.s = k
f.z = d
f.x = e
h.w = d
e.p = k
e.s = k
e.z = d
e.x = f
k.z = g
k.q = g
k.w = g
k.v = e
assert c.v.x.z.txt == "d"