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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: G = None
        self.v: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.u: A = None
        self.x: B = None
        self.w: A = None
        self.o: G = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: D = None
        self.w: G = None
        self.t: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: G = None
        self.v: E = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.u: A = None
        self.x: B = None
        self.w: A = None
        self.o: G = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: D = None
        self.w: G = None
        self.t: B = None
        self.txt = txt

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

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

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