class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: G = None
        self.p: G = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: G = None
        self.w: G = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.o: E = None
        self.txt = txt

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

c = A("c")
m = B("m")
b = C("b")
i = D("i")
d = E("d")
f = F("f")
n = G("n")
a = E("a")
g = G("g")
h = G("h")

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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: G = None
        self.w: G = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.o: E = None
        self.txt = txt

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

c = A("c")
m = B("m")
b = C("b")
i = D("i")
d = E("d")
f = F("f")
n = G("n")
a = E("a")
g = G("g")
h = G("h")

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