class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: H = None
        self.s: D = None
        self.o: H = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: A = None
        self.w: D = None
        self.r: B = None
        self.t: A = None
        self.v: A = None
        self.o: B = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.q: A = None
        self.r: H = None
        self.s: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

c.v = d
c.r = h
b.z = h
b.p = h
b.q = e
b.o = e
b.s = d
h.p = e
h.x = c
h.t = c
h.v = c
h.w = d
h.r = b
h.o = b
h.s = b
d.q = c
d.p = h
m.w = f
m.x = c
m.s = b
m.q = i
m.z = i
m.u = d
m.p = e
k.u = f
k.q = c
k.r = e
k.s = e
f.s = i
e.w = b
e.v = c
e.p = d
e.u = i
e.r = h
i.o = c
assert c.v.q.r.w.q.r.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: H = None
        self.s: D = None
        self.o: H = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: A = None
        self.w: D = None
        self.r: B = None
        self.t: A = None
        self.v: A = None
        self.o: B = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.q: A = None
        self.r: H = None
        self.s: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

c.v = d
c.r = h
b.z = h
b.p = h
b.q = e
b.o = e
b.s = d
h.p = e
h.x = c
h.t = c
h.v = c
h.w = d
h.r = b
h.o = b
h.s = b
d.q = c
d.p = h
m.w = f
m.x = c
m.s = b
m.q = i
m.z = i
m.u = d
m.p = e
k.u = f
k.q = c
k.r = e
k.s = e
f.s = i
e.w = b
e.v = c
e.p = d
e.u = i
e.r = h
i.o = c
assert c.v.q.r.w.q.r.p.p.p.txt == "h"