class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: G = None
        self.t: F = None
        self.q: B = None
        self.y: C = None
        self.s: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.x: E = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: I = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: E = None
        self.y: G = None
        self.z: B = None
        self.txt = txt

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

h = A("h")
c = B("c")
f = C("f")
e = D("e")
g = E("g")
k = F("k")
n = G("n")
m = H("m")
l = I("l")

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

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.x: E = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: I = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: G = None
        self.u: E = None
        self.y: G = None
        self.z: B = None
        self.txt = txt

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

h = A("h")
c = B("c")
f = C("f")
e = D("e")
g = E("g")
k = F("k")
n = G("n")
m = H("m")
l = I("l")

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