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

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

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

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

f = A("f")
l = B("l")
e = C("e")
n = D("n")
d = A("d")

f.q = e
f.r = e
f.v = n
l.q = n
e.x = d
e.t = l
e.z = f
n.o = e
n.y = l
d.q = e
d.r = e
d.v = n
assert n.o.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.v: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
e = C("e")
n = D("n")
d = A("d")

f.q = e
f.r = e
f.v = n
l.q = n
e.x = d
e.t = l
e.z = f
n.o = e
n.y = l
d.q = e
d.r = e
d.v = n
assert n.o.t.q.txt == "n"