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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: H = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.x: A = None
        self.y: F = None
        self.t: D = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: H = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.o: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.x: A = None
        self.y: F = None
        self.t: D = None
        self.s: E = None
        self.txt = txt

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

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

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