class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.r: B = None
        self.v: E = None
        self.s: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: E = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: H = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.o: B = None
        self.y: B = None
        self.t: C = None
        self.p: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: G = None
        self.t: A = None
        self.o: E = None
        self.p: H = None
        self.q: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: D = None
        self.z: E = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

h = A("h")
b = B("b")
j = C("j")
c = D("c")
l = E("l")
f = F("f")
m = G("m")
d = H("d")

h.p = b
h.r = b
h.u = f
h.v = l
h.s = d
b.w = f
b.z = f
b.t = l
j.t = h
j.s = h
j.q = d
c.x = m
c.p = m
c.o = b
c.y = b
c.t = j
l.p = m
l.o = f
f.x = d
f.p = d
f.r = m
f.t = h
f.o = l
f.q = c
m.w = f
m.t = c
d.u = j
d.p = j
d.q = j
d.r = c
d.z = l
assert b.t.p.w.o.p.w.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.r: B = None
        self.v: E = None
        self.s: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: E = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: H = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.o: B = None
        self.y: B = None
        self.t: C = None
        self.p: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: G = None
        self.t: A = None
        self.o: E = None
        self.p: H = None
        self.q: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: D = None
        self.z: E = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

h = A("h")
b = B("b")
j = C("j")
c = D("c")
l = E("l")
f = F("f")
m = G("m")
d = H("d")

h.p = b
h.r = b
h.u = f
h.v = l
h.s = d
b.w = f
b.z = f
b.t = l
j.t = h
j.s = h
j.q = d
c.x = m
c.p = m
c.o = b
c.y = b
c.t = j
l.p = m
l.o = f
f.x = d
f.p = d
f.r = m
f.t = h
f.o = l
f.q = c
m.w = f
m.t = c
d.u = j
d.p = j
d.q = j
d.r = c
d.z = l
assert b.t.p.w.o.p.w.r.t.txt == "c"