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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: H = None
        self.w: B = None
        self.q: C = None
        self.s: H = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.u: F = None
        self.s: C = None
        self.z: C = None
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: H = None
        self.w: B = None
        self.q: C = None
        self.s: H = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.u: F = None
        self.s: C = None
        self.z: C = None
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

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