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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: D = None
        self.o: A = 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: C = None
        self.txt = txt

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

k = A("k")
e = B("e")
c = C("c")
l = D("l")
f = E("f")
j = F("j")

k.r = j
e.z = f
c.z = e
c.y = l
c.o = k
l.r = f
f.z = c
j.y = l
j.s = c
assert l.r.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: D = None
        self.o: A = 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: C = None
        self.txt = txt

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

k = A("k")
e = B("e")
c = C("c")
l = D("l")
f = E("f")
j = F("j")

k.r = j
e.z = f
c.z = e
c.y = l
c.o = k
l.r = f
f.z = c
j.y = l
j.s = c
assert l.r.z.z.z.z.txt == "c"