class A:
    def __init__(self, txt: str):
        self.z: H = None
        self.q: D = None
        self.v: D = None
        self.w: C = None
        self.s: C = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.q: G = None
        self.r: D = None
        self.p: A = None
        self.y: E = None
        self.s: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: C = None
        self.s: D = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

d.z = j
d.q = e
d.v = e
d.w = h
d.s = h
d.y = h
k.u = b
k.v = b
k.o = e
h.x = j
h.s = j
h.q = g
h.r = e
h.p = d
h.y = b
e.q = k
b.z = d
b.o = h
b.s = e
b.r = j
f.w = d
g.r = f
g.x = f
j.q = f
j.s = h
assert g.x.w.z.s.p.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: H = None
        self.q: D = None
        self.v: D = None
        self.w: C = None
        self.s: C = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: H = None
        self.q: G = None
        self.r: D = None
        self.p: A = None
        self.y: E = None
        self.s: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: C = None
        self.s: D = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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