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

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: C = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: A = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: A = None
        self.w: A = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: F = None
        self.txt = txt

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

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

j.q = d
j.r = g
j.u = e
j.v = e
j.s = f
j.t = a
j.y = b
j.x = h
d.y = b
e.v = b
g.q = b
g.y = e
g.t = j
a.v = e
a.r = e
a.y = j
b.v = d
b.p = j
b.w = j
b.o = h
b.x = a
h.s = d
h.y = b
f.t = b
f.y = a
assert f.y.v.v.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: D = None
        self.u: C = None
        self.s: H = None
        self.t: E = None
        self.v: C = None
        self.y: F = None
        self.x: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: C = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: A = None
        self.r: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: A = None
        self.w: A = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: F = None
        self.txt = txt

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

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

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