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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: B = None
        self.v: D = None
        self.txt = txt

b = A("b")
e = B("e")
a = C("a")
f = D("f")
g = E("g")
c = F("c")
n = G("n")
i = D("i")
k = E("k")

b.y = n
e.q = n
e.s = a
e.w = b
a.u = n
f.v = c
f.z = c
f.o = c
f.q = g
g.o = b
g.q = k
c.y = n
c.x = b
n.x = c
n.o = e
n.v = f
i.v = c
i.z = c
i.o = c
i.q = k
k.o = b
k.q = g
assert g.o.y.x.x.y.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: B = None
        self.v: D = None
        self.txt = txt

b = A("b")
e = B("e")
a = C("a")
f = D("f")
g = E("g")
c = F("c")
n = G("n")
i = D("i")
k = E("k")

b.y = n
e.q = n
e.s = a
e.w = b
a.u = n
f.v = c
f.z = c
f.o = c
f.q = g
g.o = b
g.q = k
c.y = n
c.x = b
n.x = c
n.o = e
n.v = f
i.v = c
i.z = c
i.o = c
i.q = k
k.o = b
k.q = g
assert g.o.y.x.x.y.o.w.txt == "b"