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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: H = None
        self.y: D = None
        self.v: D = None
        self.w: E = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: F = None
        self.s: A = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

k.p = d
k.w = f
i.p = k
i.r = b
i.w = f
b.q = f
b.p = f
b.t = d
b.y = g
b.v = g
b.w = n
g.z = b
n.w = b
n.u = f
n.s = k
n.q = k
n.t = i
f.t = k
f.v = e
f.x = b
e.s = b
d.q = e
assert d.q.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.w: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: H = None
        self.y: D = None
        self.v: D = None
        self.w: E = None
        self.p: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: F = None
        self.s: A = None
        self.t: B = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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