class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: H = None
        self.z: G = None
        self.y: F = None
        self.o: D = None
        self.s: B = None
        self.u: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

g.w = h
b.o = i
i.o = h
i.s = g
i.u = g
d.q = b
d.w = a
a.x = j
a.u = j
a.z = n
a.y = h
a.o = d
a.s = b
h.u = a
n.q = g
j.s = d
assert d.q.o.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: H = None
        self.z: G = None
        self.y: F = None
        self.o: D = None
        self.s: B = None
        self.u: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

g.w = h
b.o = i
i.o = h
i.s = g
i.u = g
d.q = b
d.w = a
a.x = j
a.u = j
a.z = n
a.y = h
a.o = d
a.s = b
h.u = a
n.q = g
j.s = d
assert d.q.o.u.w.u.txt == "a"