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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.p: G = None
        self.x: D = None
        self.w: B = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.x: E = None
        self.z: B = None
        self.p: G = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.p: G = None
        self.x: D = None
        self.w: B = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.x: E = None
        self.z: B = None
        self.p: G = None
        self.y: C = None
        self.txt = txt

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

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