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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: G = None
        self.t: H = None
        self.u: H = None
        self.s: C = None
        self.v: A = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: H = None
        self.s: B = None
        self.x: A = None
        self.q: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: C = None
        self.u: B = None
        self.y: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: B = None
        self.v: G = None
        self.y: A = None
        self.w: B = None
        self.s: B = None
        self.u: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: G = None
        self.t: H = None
        self.u: H = None
        self.s: C = None
        self.v: A = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: H = None
        self.s: B = None
        self.x: A = None
        self.q: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: C = None
        self.u: B = None
        self.y: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: B = None
        self.v: G = None
        self.y: A = None
        self.w: B = None
        self.s: B = None
        self.u: F = None
        self.txt = txt

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

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