class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: D = None
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
i = C("i")
b = D("b")
l = D("l")

c.s = b
c.w = b
c.t = l
c.x = l
h.o = c
i.y = l
b.v = c
b.s = c
b.q = i
l.v = c
l.s = c
l.q = i
assert c.s.q.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: D = None
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
i = C("i")
b = D("b")
l = D("l")

c.s = b
c.w = b
c.t = l
c.x = l
h.o = c
i.y = l
b.v = c
b.s = c
b.q = i
l.v = c
l.s = c
l.q = i
assert c.s.q.y.s.txt == "c"