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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.z: A = None
        self.x: C = None
        self.q: F = None
        self.y: D = None
        self.s: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: G = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.z: A = None
        self.x: C = None
        self.q: F = None
        self.y: D = None
        self.s: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: G = None
        self.txt = txt

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

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