class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.q: E = None
        self.p: F = None
        self.x: E = None
        self.w: F = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.q: F = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: F = None
        self.u: B = None
        self.x: B = None
        self.q: H = None
        self.v: G = None
        self.s: H = None
        self.o: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: C = None
        self.z: B = None
        self.s: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.q: F = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: F = None
        self.u: B = None
        self.x: B = None
        self.q: H = None
        self.v: G = None
        self.s: H = None
        self.o: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: C = None
        self.z: B = None
        self.s: A = None
        self.txt = txt

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

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

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