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

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: A = None
        self.s: G = None
        self.w: E = None
        self.q: F = None
        self.r: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: B = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.s: F = None
        self.w: B = None
        self.txt = txt

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

g.q = h
n.s = f
l.v = c
l.q = h
b.z = h
b.y = g
b.r = g
b.s = c
b.w = a
b.q = f
a.o = b
f.x = m
f.q = n
f.z = a
c.q = b
c.o = n
c.w = n
c.s = f
m.o = b
h.q = b
h.o = n
h.w = n
h.s = f
assert b.s.q.z.s.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: A = None
        self.s: G = None
        self.w: E = None
        self.q: F = None
        self.r: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: B = None
        self.z: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: B = None
        self.s: F = None
        self.w: B = None
        self.txt = txt

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

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