class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: D = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

d.z = i
d.v = i
d.w = l
d.o = f
i.s = l
i.x = d
i.u = f
f.q = i
l.t = i
l.v = i
l.y = f
assert f.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: D = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

d.z = i
d.v = i
d.w = l
d.o = f
i.s = l
i.x = d
i.u = f
f.q = i
l.t = i
l.v = i
l.y = f
assert f.q.u.q.txt == "i"