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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.o: B = None
        self.u: C = None
        self.txt = txt

c = A("c")
l = B("l")
n = C("n")
d = D("d")
i = C("i")

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.o: B = None
        self.u: C = None
        self.txt = txt

c = A("c")
l = B("l")
n = C("n")
d = D("d")
i = C("i")

c.x = n
c.z = n
c.o = l
c.q = l
l.y = c
l.w = d
l.v = i
n.t = i
d.p = n
d.u = n
d.t = c
d.o = l
i.t = n
assert c.x.t.t.t.txt == "i"