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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: H = None
        self.q: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: G = None
        self.s: A = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: G = None
        self.q: D = None
        self.u: H = None
        self.t: G = None
        self.v: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.p: H = None
        self.q: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: G = None
        self.s: A = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: G = None
        self.q: D = None
        self.u: H = None
        self.t: G = None
        self.v: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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