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

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

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

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

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

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

h.t = i
h.y = e
h.x = f
i.z = h
i.y = h
i.p = a
i.o = e
i.q = g
g.t = i
g.y = e
g.q = e
e.s = a
f.q = a
a.z = h
a.y = h
a.p = i
a.o = e
a.q = g
assert g.y.s.y.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: D = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

h.t = i
h.y = e
h.x = f
i.z = h
i.y = h
i.p = a
i.o = e
i.q = g
g.t = i
g.y = e
g.q = e
e.s = a
f.q = a
a.z = h
a.y = h
a.p = i
a.o = e
a.q = g
assert g.y.s.y.y.s.txt == "a"