class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: F = None
        self.z: D = None
        self.y: G = None
        self.w: F = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: I = None
        self.q: A = None
        self.v: G = None
        self.s: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: E = None
        self.x: G = None
        self.z: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: C = None
        self.o: F = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: I = None
        self.q: A = None
        self.v: G = None
        self.s: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: E = None
        self.x: G = None
        self.z: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: C = None
        self.o: F = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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