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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.t: A = None
        self.q: F = None
        self.s: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: A = None
        self.t: D = None
        self.s: C = None
        self.y: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: D = None
        self.t: A = None
        self.q: F = None
        self.s: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: A = None
        self.t: D = None
        self.s: C = None
        self.y: F = None
        self.txt = txt

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

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