class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: H = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: E = None
        self.r: A = None
        self.s: G = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.t: A = None
        self.z: F = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

m.u = j
m.x = d
m.o = i
j.x = i
j.o = g
j.r = m
j.p = m
j.s = h
f.o = e
f.q = h
e.r = j
e.z = j
e.o = j
e.s = g
g.r = i
g.t = j
i.t = m
i.s = m
i.o = e
i.w = f
h.p = j
h.w = j
h.t = m
h.z = i
h.x = f
d.y = f
assert g.r.o.s.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: H = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: E = None
        self.r: A = None
        self.s: G = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: E = None
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: B = None
        self.t: A = None
        self.z: F = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

m.u = j
m.x = d
m.o = i
j.x = i
j.o = g
j.r = m
j.p = m
j.s = h
f.o = e
f.q = h
e.r = j
e.z = j
e.o = j
e.s = g
g.r = i
g.t = j
i.t = m
i.s = m
i.o = e
i.w = f
h.p = j
h.w = j
h.t = m
h.z = i
h.x = f
d.y = f
assert g.r.o.s.r.w.txt == "f"