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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.z: D = None
        self.w: C = None
        self.o: D = None
        self.s: D = None
        self.t: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

class I:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: C = None
        self.z: D = None
        self.w: C = None
        self.o: D = None
        self.s: D = None
        self.t: E = None
        self.txt = txt

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

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