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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: G = None
        self.z: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: G = None
        self.z: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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