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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: C = None
        self.s: A = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: F = None
        self.w: G = None
        self.z: B = None
        self.y: D = None
        self.r: B = None
        self.s: F = None
        self.txt = txt

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

k = A("k")
c = B("c")
h = C("h")
d = D("d")
m = E("m")
i = F("i")
n = G("n")
g = H("g")
f = G("f")

k.z = f
k.w = f
c.w = d
c.x = h
c.s = k
c.r = i
h.y = i
h.x = c
d.u = c
d.w = m
m.t = g
m.o = g
m.r = f
m.s = n
m.x = i
i.y = g
i.r = g
n.u = g
n.x = i
n.s = i
n.w = f
n.z = c
n.r = c
n.y = d
g.t = d
g.s = h
g.u = i
f.u = g
f.x = i
f.s = i
f.w = n
f.z = c
f.r = c
f.y = d
assert n.u.s.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: C = None
        self.s: A = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: F = None
        self.w: G = None
        self.z: B = None
        self.y: D = None
        self.r: B = None
        self.s: F = None
        self.txt = txt

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

k = A("k")
c = B("c")
h = C("h")
d = D("d")
m = E("m")
i = F("i")
n = G("n")
g = H("g")
f = G("f")

k.z = f
k.w = f
c.w = d
c.x = h
c.s = k
c.r = i
h.y = i
h.x = c
d.u = c
d.w = m
m.t = g
m.o = g
m.r = f
m.s = n
m.x = i
i.y = g
i.r = g
n.u = g
n.x = i
n.s = i
n.w = f
n.z = c
n.r = c
n.y = d
g.t = d
g.s = h
g.u = i
f.u = g
f.x = i
f.s = i
f.w = n
f.z = c
f.r = c
f.y = d
assert n.u.s.y.r.txt == "g"