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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: C = None
        self.u: B = None
        self.r: A = None
        self.txt = txt

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

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

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

g.s = f
n.v = k
n.t = f
n.s = m
n.y = g
k.r = g
a.w = k
a.t = k
a.u = n
a.r = g
m.s = f
f.s = m
f.w = m
f.z = g
f.y = n
assert f.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: C = None
        self.u: B = None
        self.r: A = None
        self.txt = txt

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

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

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

g.s = f
n.v = k
n.t = f
n.s = m
n.y = g
k.r = g
a.w = k
a.t = k
a.u = n
a.r = g
m.s = f
f.s = m
f.w = m
f.z = g
f.y = n
assert f.z.s.z.txt == "g"