class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: G = None
        self.q: H = 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.p: G = None
        self.q: D = None
        self.y: C = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: G = None
        self.q: H = 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.p: G = None
        self.q: D = None
        self.y: C = None
        self.s: E = None
        self.txt = txt

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

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