class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: B = None
        self.s: G = None
        self.q: C = None
        self.r: F = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

f = A("f")
d = B("d")
i = C("i")
k = D("k")
c = E("c")
m = F("m")
h = G("h")
j = A("j")
n = E("n")
e = D("e")

f.p = m
f.r = m
f.v = m
f.z = d
f.s = h
f.q = i
d.r = c
d.z = e
i.t = e
i.w = f
i.p = h
k.p = h
k.r = j
k.w = c
k.o = f
k.t = i
c.w = e
m.p = h
h.v = k
h.p = f
h.z = d
j.p = m
j.r = m
j.v = m
j.z = d
j.s = h
j.q = i
n.w = k
e.p = h
e.r = f
e.o = f
e.w = c
e.t = i
assert j.s.p.s.v.p.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: B = None
        self.s: G = None
        self.q: C = None
        self.r: F = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

f = A("f")
d = B("d")
i = C("i")
k = D("k")
c = E("c")
m = F("m")
h = G("h")
j = A("j")
n = E("n")
e = D("e")

f.p = m
f.r = m
f.v = m
f.z = d
f.s = h
f.q = i
d.r = c
d.z = e
i.t = e
i.w = f
i.p = h
k.p = h
k.r = j
k.w = c
k.o = f
k.t = i
c.w = e
m.p = h
h.v = k
h.p = f
h.z = d
j.p = m
j.r = m
j.v = m
j.z = d
j.s = h
j.q = i
n.w = k
e.p = h
e.r = f
e.o = f
e.w = c
e.t = i
assert j.s.p.s.v.p.p.r.p.txt == "h"