class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.s: A = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: A = None
        self.x: A = None
        self.z: H = None
        self.t: H = None
        self.v: D = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: H = None
        self.q: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: F = None
        self.u: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: D = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.s: A = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: A = None
        self.x: A = None
        self.z: H = None
        self.t: H = None
        self.v: D = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: H = None
        self.q: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: F = None
        self.u: A = None
        self.txt = txt

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

f.p = a
f.r = k
k.s = l
k.p = l
k.w = e
k.y = e
k.u = a
k.q = a
k.t = a
k.v = g
l.w = g
l.r = g
l.t = f
g.y = a
g.s = f
g.r = f
e.q = n
e.u = f
e.x = f
e.z = a
e.t = a
e.v = g
e.p = l
n.t = l
n.w = h
h.x = a
h.r = a
h.q = a
a.o = g
a.x = n
a.u = f
assert a.o.s.r.q.o.txt == "g"