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

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

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

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

a = A("a")
n = B("n")
c = C("c")
i = D("i")

a.v = c
n.x = c
c.q = i
c.x = i
c.t = i
i.y = c
i.r = c
i.u = c
assert n.x.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
c = C("c")
i = D("i")

a.v = c
n.x = c
c.q = i
c.x = i
c.t = i
i.y = c
i.r = c
i.u = c
assert n.x.q.r.txt == "c"