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

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

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

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

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

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

i = A("i")
b = B("b")
l = C("l")
h = D("h")
f = E("f")
a = F("a")
n = A("n")
m = E("m")

i.r = n
b.s = a
b.w = a
b.o = l
b.z = m
l.y = b
l.o = b
h.w = l
h.s = f
h.z = b
f.p = m
f.s = i
f.t = h
a.r = n
a.z = f
n.r = i
m.p = f
m.s = n
m.t = h
assert i.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

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

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

i = A("i")
b = B("b")
l = C("l")
h = D("h")
f = E("f")
a = F("a")
n = A("n")
m = E("m")

i.r = n
b.s = a
b.w = a
b.o = l
b.z = m
l.y = b
l.o = b
h.w = l
h.s = f
h.z = b
f.p = m
f.s = i
f.t = h
a.r = n
a.z = f
n.r = i
m.p = f
m.s = n
m.t = h
assert i.r.r.r.r.r.r.r.r.txt == "i"