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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: E = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: E = None
        self.o: E = None
        self.txt = txt

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

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

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

h.o = i
b.q = m
b.r = m
b.y = i
m.u = e
m.t = e
m.y = f
n.o = h
n.x = h
n.z = g
n.u = f
n.q = f
n.y = i
n.v = e
f.v = e
f.o = g
f.z = h
f.r = h
f.t = b
e.x = h
e.z = f
e.o = f
g.x = n
i.x = b
assert e.x.o.x.y.txt == "i"