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

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

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

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

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

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

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

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

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

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

c.v = i
c.q = b
c.w = d
c.y = j
d.x = g
d.o = b
d.y = b
d.z = j
j.p = i
b.s = g
g.v = i
g.q = b
g.w = d
g.y = j
i.s = g
assert i.s.q.s.w.o.txt == "b"