class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.o: G = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: C = None
        self.v: D = None
        self.r: C = None
        self.w: E = None
        self.o: F = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.x: B = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: B = None
        self.o: B = None
        self.w: B = None
        self.y: B = None
        self.u: G = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.s: C = None
        self.u: H = None
        self.p: G = None
        self.x: H = None
        self.t: G = None
        self.z: B = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: D = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.txt = txt

a = A("a")
g = B("g")
l = C("l")
d = D("d")
m = E("m")
h = F("h")
f = G("f")
i = H("i")
c = D("c")

a.q = i
a.o = f
a.y = h
g.x = h
g.o = h
g.y = l
g.r = l
g.v = d
g.w = m
g.t = a
l.q = g
l.y = g
l.x = g
l.r = h
l.v = f
d.s = m
d.x = g
d.o = g
d.w = g
d.y = g
d.u = f
d.q = i
m.w = i
m.u = i
m.x = i
m.s = l
m.p = f
m.t = f
m.z = g
m.y = d
h.s = a
h.x = d
h.o = m
h.z = c
f.y = c
i.z = c
i.p = l
c.s = m
c.x = g
c.o = g
c.w = g
c.y = g
c.u = f
c.q = i
assert d.x.t.y.x.u.y.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.o: G = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: C = None
        self.v: D = None
        self.r: C = None
        self.w: E = None
        self.o: F = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.x: B = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: B = None
        self.o: B = None
        self.w: B = None
        self.y: B = None
        self.u: G = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.s: C = None
        self.u: H = None
        self.p: G = None
        self.x: H = None
        self.t: G = None
        self.z: B = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: D = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.txt = txt

a = A("a")
g = B("g")
l = C("l")
d = D("d")
m = E("m")
h = F("h")
f = G("f")
i = H("i")
c = D("c")

a.q = i
a.o = f
a.y = h
g.x = h
g.o = h
g.y = l
g.r = l
g.v = d
g.w = m
g.t = a
l.q = g
l.y = g
l.x = g
l.r = h
l.v = f
d.s = m
d.x = g
d.o = g
d.w = g
d.y = g
d.u = f
d.q = i
m.w = i
m.u = i
m.x = i
m.s = l
m.p = f
m.t = f
m.z = g
m.y = d
h.s = a
h.x = d
h.o = m
h.z = c
f.y = c
i.z = c
i.p = l
c.s = m
c.x = g
c.o = g
c.w = g
c.y = g
c.u = f
c.q = i
assert d.x.t.y.x.u.y.o.o.txt == "h"