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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: H = None
        self.z: B = None
        self.s: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: H = None
        self.z: B = None
        self.s: E = None
        self.x: E = None
        self.txt = txt

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

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

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