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

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

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

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

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

b = A("b")
g = B("g")
m = C("m")
c = D("c")
n = E("n")
f = A("f")
h = B("h")
i = D("i")
a = C("a")

b.s = c
b.q = a
b.x = a
g.q = c
m.p = c
m.y = a
m.t = g
c.t = n
c.r = h
c.u = i
n.t = g
n.p = i
f.s = c
f.q = m
f.x = m
h.q = i
i.t = n
i.r = g
i.u = c
a.p = c
a.y = m
a.t = h
assert h.q.u.t.p.u.t.p.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: C = None
        self.x: C = None
        self.txt = txt

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

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

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

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

b = A("b")
g = B("g")
m = C("m")
c = D("c")
n = E("n")
f = A("f")
h = B("h")
i = D("i")
a = C("a")

b.s = c
b.q = a
b.x = a
g.q = c
m.p = c
m.y = a
m.t = g
c.t = n
c.r = h
c.u = i
n.t = g
n.p = i
f.s = c
f.q = m
f.x = m
h.q = i
i.t = n
i.r = g
i.u = c
a.p = c
a.y = m
a.t = h
assert h.q.u.t.p.u.t.p.t.t.txt == "g"