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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

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

h.s = n
h.x = n
h.p = n
h.v = f
f.x = c
f.t = h
n.q = c
n.p = c
n.u = i
n.z = f
c.x = h
c.o = f
l.w = n
i.w = n
assert l.w.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

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

h.s = n
h.x = n
h.p = n
h.v = f
f.x = c
f.t = h
n.q = c
n.p = c
n.u = i
n.z = f
c.x = h
c.o = f
l.w = n
i.w = n
assert l.w.p.o.txt == "f"