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

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

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

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

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

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

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

m = A("m")
g = B("g")
a = C("a")
k = D("k")
c = E("c")
i = F("i")
h = G("h")
d = D("d")

m.v = a
m.q = h
m.w = c
g.o = i
g.s = a
g.x = a
a.s = m
a.y = i
a.r = c
k.s = i
c.q = a
c.w = a
c.t = m
i.v = k
h.v = c
h.y = c
h.r = m
d.s = i
assert k.s.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: G = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

m = A("m")
g = B("g")
a = C("a")
k = D("k")
c = E("c")
i = F("i")
h = G("h")
d = D("d")

m.v = a
m.q = h
m.w = c
g.o = i
g.s = a
g.x = a
a.s = m
a.y = i
a.r = c
k.s = i
c.q = a
c.w = a
c.t = m
i.v = k
h.v = c
h.y = c
h.r = m
d.s = i
assert k.s.v.s.v.txt == "k"