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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: H = None
        self.z: B = None
        self.r: A = None
        self.y: B = None
        self.s: E = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.t: G = None
        self.z: F = None
        self.q: D = None
        self.y: D = None
        self.p: A = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: H = None
        self.z: B = None
        self.r: A = None
        self.y: B = None
        self.s: E = None
        self.v: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.t: G = None
        self.z: F = None
        self.q: D = None
        self.y: D = None
        self.p: A = None
        self.w: D = None
        self.txt = txt

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

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