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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

m = A("m")
j = B("j")
a = C("a")
k = D("k")
g = E("g")
n = F("n")
f = F("f")
i = B("i")

m.o = k
m.z = a
j.y = k
j.x = k
j.r = m
j.s = m
a.v = i
k.s = a
k.q = a
k.z = i
g.v = n
g.q = j
g.y = i
n.z = g
n.r = f
f.z = g
f.r = n
i.y = k
i.x = k
i.r = m
i.s = m
assert m.z.v.r.o.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.z: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

m = A("m")
j = B("j")
a = C("a")
k = D("k")
g = E("g")
n = F("n")
f = F("f")
i = B("i")

m.o = k
m.z = a
j.y = k
j.x = k
j.r = m
j.s = m
a.v = i
k.s = a
k.q = a
k.z = i
g.v = n
g.q = j
g.y = i
n.z = g
n.r = f
f.z = g
f.r = n
i.y = k
i.x = k
i.r = m
i.s = m
assert m.z.v.r.o.s.v.x.txt == "k"