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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: D = None
        self.r: B = None
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: D = None
        self.r: B = None
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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