class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: H = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.x: F = None
        self.s: F = None
        self.o: G = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: A = None
        self.x: D = None
        self.v: B = None
        self.r: G = None
        self.p: B = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
l = C("l")
h = D("h")
b = E("b")
j = F("j")
m = G("m")
a = H("a")
k = H("k")

n.y = j
g.w = h
g.q = j
g.x = j
g.u = k
l.u = m
l.r = g
l.y = h
h.w = b
h.q = a
h.r = m
b.t = g
b.y = g
b.x = j
b.s = j
b.o = m
b.r = k
j.o = b
j.t = n
j.x = h
j.v = g
j.p = g
j.r = m
m.p = j
a.q = n
k.q = n
assert h.w.r.q.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: H = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: B = None
        self.x: F = None
        self.s: F = None
        self.o: G = None
        self.r: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: A = None
        self.x: D = None
        self.v: B = None
        self.r: G = None
        self.p: B = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
l = C("l")
h = D("h")
b = E("b")
j = F("j")
m = G("m")
a = H("a")
k = H("k")

n.y = j
g.w = h
g.q = j
g.x = j
g.u = k
l.u = m
l.r = g
l.y = h
h.w = b
h.q = a
h.r = m
b.t = g
b.y = g
b.x = j
b.s = j
b.o = m
b.r = k
j.o = b
j.t = n
j.x = h
j.v = g
j.p = g
j.r = m
m.p = j
a.q = n
k.q = n
assert h.w.r.q.y.p.txt == "g"