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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: B = None
        self.v: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.t: G = None
        self.txt = txt

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

j = A("j")
b = B("b")
a = C("a")
m = D("m")
i = E("i")
n = F("n")
h = G("h")
g = B("g")

j.z = g
b.z = j
a.v = i
a.o = h
a.s = h
m.r = i
i.z = m
i.x = g
i.v = b
n.x = g
n.q = i
n.t = h
h.v = n
h.q = n
h.r = i
h.s = j
g.z = j
assert m.r.v.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: B = None
        self.v: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.t: G = None
        self.txt = txt

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

j = A("j")
b = B("b")
a = C("a")
m = D("m")
i = E("i")
n = F("n")
h = G("h")
g = B("g")

j.z = g
b.z = j
a.v = i
a.o = h
a.s = h
m.r = i
i.z = m
i.x = g
i.v = b
n.x = g
n.q = i
n.t = h
h.v = n
h.q = n
h.r = i
h.s = j
g.z = j
assert m.r.v.z.z.z.z.z.txt == "j"