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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: A = None
        self.v: B = None
        self.x: F = None
        self.txt = txt

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

g.s = k
j.r = k
j.x = f
j.o = g
f.z = i
f.t = j
i.p = d
i.t = m
d.o = e
d.v = k
e.r = j
e.v = j
e.u = g
e.x = m
m.r = j
m.v = j
m.u = g
m.x = e
k.s = g
a.z = i
a.t = j
assert g.s.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: A = None
        self.v: B = None
        self.x: F = None
        self.txt = txt

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

g.s = k
j.r = k
j.x = f
j.o = g
f.z = i
f.t = j
i.p = d
i.t = m
d.o = e
d.v = k
e.r = j
e.v = j
e.u = g
e.x = m
m.r = j
m.v = j
m.u = g
m.x = e
k.s = g
a.z = i
a.t = j
assert g.s.s.s.s.s.s.s.s.txt == "g"