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

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

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

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

c = A("c")
i = B("i")
b = C("b")
j = D("j")

c.r = j
c.w = j
i.x = j
i.o = j
b.x = i
b.s = j
b.o = j
j.v = i
j.p = b
j.y = b
assert j.y.s.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: D = None
        self.txt = txt

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

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

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

c = A("c")
i = B("i")
b = C("b")
j = D("j")

c.r = j
c.w = j
i.x = j
i.o = j
b.x = i
b.s = j
b.o = j
j.v = i
j.p = b
j.y = b
assert j.y.s.y.x.txt == "i"