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

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

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

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

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

i.y = l
l.t = k
k.o = l
k.u = l
k.t = i
k.x = f
f.q = i
f.t = k
f.w = l
assert f.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

i.y = l
l.t = k
k.o = l
k.u = l
k.t = i
k.x = f
f.q = i
f.t = k
f.w = l
assert f.t.o.t.txt == "k"