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

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

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

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

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

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

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

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

n.s = a
n.z = a
k.z = m
k.r = h
i.x = k
i.s = d
d.t = n
d.v = l
d.o = i
h.q = m
h.w = a
a.y = l
m.z = a
m.v = a
m.q = h
l.t = n
l.v = d
l.o = i
assert h.w.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

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

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