class A:
    def __init__(self, txt: str):
        self.p: I = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: I = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.o: E = None
        self.q: I = None
        self.y: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: C = None
        self.v: I = None
        self.x: I = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: H = None
        self.p: F = None
        self.t: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: I = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.o: E = None
        self.q: I = None
        self.y: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: C = None
        self.v: I = None
        self.x: I = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: H = None
        self.q: H = None
        self.p: F = None
        self.t: B = None
        self.txt = txt

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

k.p = h
d.v = h
b.r = g
i.z = g
i.t = n
i.o = n
i.q = h
i.y = m
n.x = c
g.r = i
g.w = h
m.o = k
m.w = b
m.v = h
m.x = h
m.z = g
c.s = k
h.w = c
h.q = c
h.p = g
h.t = d
assert n.x.s.p.t.v.w.s.p.p.txt == "g"