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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: G = None
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: A = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: G = None
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: A = None
        self.q: A = None
        self.txt = txt

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

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

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