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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: A = None
        self.x: G = None
        self.v: D = None
        self.o: D = None
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
j = C("j")
c = D("c")
n = E("n")
d = F("d")
a = G("a")

k.v = m
k.o = m
m.x = d
m.v = j
j.q = m
j.s = d
j.u = n
c.v = a
n.y = c
n.v = c
n.o = c
n.t = k
n.x = a
n.s = j
d.z = j
a.z = n
assert j.u.t.o.v.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: A = None
        self.x: G = None
        self.v: D = None
        self.o: D = None
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
j = C("j")
c = D("c")
n = E("n")
d = F("d")
a = G("a")

k.v = m
k.o = m
m.x = d
m.v = j
j.q = m
j.s = d
j.u = n
c.v = a
n.y = c
n.v = c
n.o = c
n.t = k
n.x = a
n.s = j
d.z = j
a.z = n
assert j.u.t.o.v.s.z.txt == "j"