class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: D = None
        self.s: B = None
        self.u: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: F = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

i = A("i")
a = B("a")
f = C("f")
n = D("n")
j = E("j")
b = F("b")
k = G("k")
h = H("h")
e = B("e")
g = B("g")

i.o = g
i.s = g
i.t = n
i.u = h
a.w = f
a.y = i
a.q = e
f.p = h
f.r = b
f.x = j
n.p = b
n.u = a
j.r = a
b.r = k
b.y = k
k.r = f
h.p = a
h.t = a
h.o = f
h.r = n
e.w = f
e.y = i
e.q = g
g.w = f
g.y = i
g.q = a
assert h.r.p.y.r.p.t.y.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: D = None
        self.s: B = None
        self.u: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: F = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

i = A("i")
a = B("a")
f = C("f")
n = D("n")
j = E("j")
b = F("b")
k = G("k")
h = H("h")
e = B("e")
g = B("g")

i.o = g
i.s = g
i.t = n
i.u = h
a.w = f
a.y = i
a.q = e
f.p = h
f.r = b
f.x = j
n.p = b
n.u = a
j.r = a
b.r = k
b.y = k
k.r = f
h.p = a
h.t = a
h.o = f
h.r = n
e.w = f
e.y = i
e.q = g
g.w = f
g.y = i
g.q = a
assert h.r.p.y.r.p.t.y.o.q.txt == "a"