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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: D = None
        self.p: B = None
        self.t: H = None
        self.w: A = None
        self.x: A = None
        self.z: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: E = None
        self.w: A = None
        self.v: F = None
        self.t: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: D = None
        self.p: B = None
        self.t: H = None
        self.w: A = None
        self.x: A = None
        self.z: H = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: E = None
        self.w: A = None
        self.v: F = None
        self.t: F = None
        self.txt = txt

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

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