class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: B = None
        self.o: H = None
        self.r: B = None
        self.txt = txt

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: C = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: B = None
        self.o: H = None
        self.r: B = None
        self.txt = txt

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: C = None
        self.u: D = None
        self.txt = txt

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

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