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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: G = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: G = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: G = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: G = None
        self.q: D = None
        self.txt = txt

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

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