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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: C = None
        self.x: F = None
        self.y: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.x: A = None
        self.txt = txt

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

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

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

i.p = g
i.q = a
i.z = a
a.t = n
a.w = m
a.r = b
h.z = n
b.u = g
b.x = g
b.z = h
b.y = c
n.q = b
n.t = b
n.u = c
n.v = i
n.w = m
n.r = j
g.x = b
m.t = h
m.p = b
m.x = i
c.x = i
c.r = g
c.v = n
c.t = m
j.w = i
j.p = b
j.u = b
j.x = n
j.q = c
j.t = h
j.v = h
assert i.p.x.y.v.w.x.q.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: C = None
        self.x: F = None
        self.y: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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