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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.x: C = None
        self.s: A = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
i = C("i")
g = D("g")
n = B("n")

f.s = i
l.v = g
l.r = i
l.x = i
l.s = f
i.o = g
g.z = f
g.q = f
g.y = i
g.u = i
n.v = g
n.r = i
n.x = i
n.s = f
assert i.o.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: C = None
        self.x: C = None
        self.s: A = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
i = C("i")
g = D("g")
n = B("n")

f.s = i
l.v = g
l.r = i
l.x = i
l.s = f
i.o = g
g.z = f
g.q = f
g.y = i
g.u = i
n.v = g
n.r = i
n.x = i
n.s = f
assert i.o.q.s.txt == "i"