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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: A = None
        self.o: B = None
        self.t: A = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: H = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: I = None
        self.txt = txt

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

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

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

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

f.q = m
f.u = b
f.y = h
f.o = h
f.t = k
f.v = i
f.w = j
f.z = j
c.r = j
g.p = c
g.o = c
g.u = f
g.t = f
g.x = b
k.z = c
b.z = m
b.w = j
b.r = j
m.r = i
h.z = b
h.q = j
h.w = m
h.v = g
h.p = g
h.y = c
h.x = c
h.u = f
j.w = c
j.v = h
i.r = k
i.q = k
i.u = b
i.v = j
i.x = g
assert g.o.r.w.r.w.r.w.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: E = None
        self.y: G = None
        self.o: G = None
        self.t: D = None
        self.v: I = None
        self.w: H = None
        self.z: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: A = None
        self.o: B = None
        self.t: A = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: H = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: I = None
        self.txt = txt

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

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

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

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

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