class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: C = None
        self.q: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.o: F = None
        self.q: G = None
        self.v: F = None
        self.p: A = None
        self.y: G = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: C = None
        self.r: G = None
        self.p: A = None
        self.q: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.o: F = None
        self.q: G = None
        self.v: F = None
        self.p: A = None
        self.y: G = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: C = None
        self.r: G = None
        self.p: A = None
        self.q: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.txt = txt

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

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

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