class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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