class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: E = None
        self.p: D = None
        self.w: G = None
        self.o: C = None
        self.q: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: A = None
        self.s: A = None
        self.v: C = None
        self.x: B = None
        self.y: E = None
        self.r: E = None
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: A = None
        self.x: A = None
        self.o: B = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: A = None
        self.s: A = None
        self.v: C = None
        self.x: B = None
        self.y: E = None
        self.r: E = None
        self.u: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: A = None
        self.x: A = None
        self.o: B = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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