class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: G = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: G = None
        self.w: F = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: B = None
        self.q: C = None
        self.u: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: G = None
        self.q: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: G = None
        self.w: F = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: B = None
        self.q: C = None
        self.u: G = None
        self.txt = txt

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

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