class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: H = None
        self.o: G = None
        self.y: H = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: H = None
        self.p: F = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: A = None
        self.s: H = None
        self.r: F = None
        self.q: B = None
        self.t: D = None
        self.x: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: H = None
        self.p: F = None
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: A = None
        self.s: H = None
        self.r: F = None
        self.q: B = None
        self.t: D = None
        self.x: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: H = None
        self.o: D = None
        self.txt = txt

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

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

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

i.t = h
i.o = h
i.x = b
i.y = b
i.z = a
d.t = e
e.y = d
e.w = b
e.p = n
e.t = a
a.o = e
f.v = a
f.t = a
f.w = i
f.s = b
f.x = b
f.r = n
f.q = d
n.y = b
n.o = a
h.x = d
h.r = f
b.v = e
assert d.t.y.t.w.v.p.o.txt == "a"