class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: G = None
        self.o: A = None
        self.r: F = None
        self.x: C = None
        self.s: F = None
        self.z: E = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
j = C("j")
g = D("g")
a = E("a")
k = F("k")
d = G("d")
n = G("n")

l.w = g
b.p = l
j.o = n
g.u = n
g.v = n
g.o = l
g.r = k
g.s = k
g.x = j
g.z = a
a.v = l
k.v = j
k.o = b
k.s = n
d.z = j
d.w = j
n.z = j
n.w = j
assert a.v.w.u.w.o.z.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: G = None
        self.o: A = None
        self.r: F = None
        self.x: C = None
        self.s: F = None
        self.z: E = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
j = C("j")
g = D("g")
a = E("a")
k = F("k")
d = G("d")
n = G("n")

l.w = g
b.p = l
j.o = n
g.u = n
g.v = n
g.o = l
g.r = k
g.s = k
g.x = j
g.z = a
a.v = l
k.v = j
k.o = b
k.s = n
d.z = j
d.w = j
n.z = j
n.w = j
assert a.v.w.u.w.o.z.o.w.txt == "j"