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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: A = None
        self.u: E = None
        self.y: G = None
        self.q: H = None
        self.o: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: A = None
        self.u: E = None
        self.y: G = None
        self.q: H = None
        self.o: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

n.y = d
n.u = e
n.p = m
k.s = f
k.q = d
k.w = i
e.x = k
e.z = n
e.u = d
e.o = d
e.y = i
e.q = c
e.w = m
m.r = i
m.x = k
d.y = c
d.w = m
d.o = m
f.u = i
f.x = i
f.r = i
f.q = d
f.p = d
f.w = n
i.u = n
i.p = n
i.t = k
i.o = f
c.w = e
c.s = n
assert c.s.y.w.r.t.txt == "k"