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

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

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

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

i = A("i")
h = B("h")
f = C("f")
c = D("c")
a = C("a")

i.s = c
i.v = c
i.y = f
h.o = a
h.y = f
h.x = i
h.z = c
f.q = h
f.o = h
f.x = h
f.r = c
c.p = h
c.v = h
c.w = i
c.x = i
a.q = h
a.o = h
a.x = h
a.r = c
assert h.o.r.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: C = None
        self.v: D = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
f = C("f")
c = D("c")
a = C("a")

i.s = c
i.v = c
i.y = f
h.o = a
h.y = f
h.x = i
h.z = c
f.q = h
f.o = h
f.x = h
f.r = c
c.p = h
c.v = h
c.w = i
c.x = i
a.q = h
a.o = h
a.x = h
a.r = c
assert h.o.r.p.y.txt == "f"