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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.s: A = None
        self.q: A = None
        self.z: H = None
        self.u: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: A = None
        self.v: G = None
        self.t: F = None
        self.u: F = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.s: A = None
        self.q: A = None
        self.z: H = None
        self.u: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: A = None
        self.v: G = None
        self.t: F = None
        self.u: F = None
        self.p: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

i.o = d
i.y = n
i.w = c
i.u = f
f.v = n
f.s = i
f.q = i
f.z = d
f.u = h
c.w = n
c.u = e
c.q = i
h.z = g
e.y = i
e.x = i
e.v = n
e.t = g
e.u = g
e.p = g
g.p = f
n.x = i
n.u = e
n.q = f
d.v = n
d.s = c
assert h.z.p.u.z.p.q.u.q.txt == "i"