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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: F = None
        self.y: H = None
        self.r: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: D = None
        self.v: G = None
        self.o: D = None
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

m.p = e
m.y = d
i.y = e
i.s = e
i.x = d
i.v = g
i.z = c
c.s = i
c.w = e
c.y = a
c.r = a
k.o = d
g.x = k
g.t = k
g.o = k
g.v = d
g.s = c
e.p = i
e.t = m
d.t = m
d.o = e
d.p = g
d.z = k
a.w = i
assert a.w.z.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: F = None
        self.y: H = None
        self.r: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.t: D = None
        self.v: G = None
        self.o: D = None
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

m.p = e
m.y = d
i.y = e
i.s = e
i.x = d
i.v = g
i.z = c
c.s = i
c.w = e
c.y = a
c.r = a
k.o = d
g.x = k
g.t = k
g.o = k
g.v = d
g.s = c
e.p = i
e.t = m
d.t = m
d.o = e
d.p = g
d.z = k
a.w = i
assert a.w.z.r.w.txt == "i"