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

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

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

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

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

b.s = c
b.z = j
b.v = j
m.v = f
i.o = j
i.u = f
j.o = i
j.q = c
f.v = m
c.s = b
c.z = j
c.v = j
assert c.z.q.z.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

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

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

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

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

b.s = c
b.z = j
b.v = j
m.v = f
i.o = j
i.u = f
j.o = i
j.q = c
f.v = m
c.s = b
c.z = j
c.v = j
assert c.z.q.z.q.v.q.txt == "c"