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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.q: C = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: F = None
        self.p: A = None
        self.s: F = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.q: C = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: F = None
        self.p: A = None
        self.s: F = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

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

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

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

h.w = n
h.u = b
m.y = g
m.x = g
m.s = i
m.o = i
m.v = h
g.w = h
g.s = n
g.x = m
e.o = h
e.x = m
e.q = g
e.s = i
i.u = n
i.w = d
i.s = d
i.p = h
i.r = m
i.x = e
d.s = i
d.u = i
d.x = n
b.t = m
n.y = i
n.x = e
assert d.u.u.y.txt == "i"