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

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

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

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

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

l = A("l")
e = B("e")
g = C("g")
a = D("a")
j = E("j")

l.s = g
e.o = a
g.v = l
a.t = j
j.w = l
j.z = l
j.t = a
assert a.t.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

l = A("l")
e = B("e")
g = C("g")
a = D("a")
j = E("j")

l.s = g
e.o = a
g.v = l
a.t = j
j.w = l
j.z = l
j.t = a
assert a.t.z.s.txt == "g"