class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: F = None
        self.s: G = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: H = None
        self.x: H = None
        self.q: G = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: F = None
        self.s: G = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: H = None
        self.x: H = None
        self.q: G = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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