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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: E = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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