class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: G = None
        self.s: G = None
        self.txt = txt

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

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

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

g.s = f
g.r = f
g.q = c
c.s = g
c.y = i
h.y = f
h.p = g
e.y = m
e.w = g
e.p = f
f.y = e
i.x = c
i.q = k
i.s = k
k.w = e
m.s = h
m.t = e
assert e.w.q.s.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: G = None
        self.s: G = None
        self.txt = txt

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

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

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

g.s = f
g.r = f
g.q = c
c.s = g
c.y = i
h.y = f
h.p = g
e.y = m
e.w = g
e.p = f
f.y = e
i.x = c
i.q = k
i.s = k
k.w = e
m.s = h
m.t = e
assert e.w.q.s.q.y.txt == "i"