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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: B = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

l.y = i
e.y = l
i.r = e
i.y = f
f.s = i
k.u = e
k.x = e
k.o = e
k.v = e
j.y = i
assert f.s.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: B = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

l.y = i
e.y = l
i.r = e
i.y = f
f.s = i
k.u = e
k.x = e
k.o = e
k.v = e
j.y = i
assert f.s.y.s.y.txt == "f"