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

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
n = D("n")
e = E("e")

h.s = n
f.p = i
f.z = i
f.t = e
f.x = e
f.w = h
i.o = h
i.s = n
i.p = f
n.u = i
n.w = f
e.z = f
e.v = i
e.y = i
e.p = i
assert h.s.w.x.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
n = D("n")
e = E("e")

h.s = n
f.p = i
f.z = i
f.t = e
f.x = e
f.w = h
i.o = h
i.s = n
i.p = f
n.u = i
n.w = f
e.z = f
e.v = i
e.y = i
e.p = i
assert h.s.w.x.z.p.txt == "i"