class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: B = None
        self.x: D = None
        self.s: E = None
        self.z: D = 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: B = None
        self.q: B = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
a = C("a")
h = D("h")
i = E("i")

c.v = a
c.y = f
c.x = h
c.z = h
c.s = i
f.z = i
a.z = f
a.q = f
h.t = a
i.x = f
i.s = a
assert f.z.x.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: B = None
        self.x: D = None
        self.s: E = None
        self.z: D = 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: B = None
        self.q: B = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
a = C("a")
h = D("h")
i = E("i")

c.v = a
c.y = f
c.x = h
c.z = h
c.s = i
f.z = i
a.z = f
a.q = f
h.t = a
i.x = f
i.s = a
assert f.z.x.z.s.txt == "a"