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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: B = None
        self.v: E = None
        self.p: F = None
        self.y: C = None
        self.o: C = None
        self.r: A = None
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: C = None
        self.y: C = None
        self.o: G = None
        self.v: E = None
        self.s: E = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: C = None
        self.z: G = None
        self.o: G = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: B = None
        self.v: E = None
        self.p: F = None
        self.y: C = None
        self.o: C = None
        self.r: A = None
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: C = None
        self.y: C = None
        self.o: G = None
        self.v: E = None
        self.s: E = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: C = None
        self.z: G = None
        self.o: G = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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