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

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

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

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

c = A("c")
j = B("j")
a = C("a")
b = D("b")
h = C("h")
k = B("k")
l = C("l")
f = D("f")

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

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

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

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

c = A("c")
j = B("j")
a = C("a")
b = D("b")
h = C("h")
k = B("k")
l = C("l")
f = D("f")

c.s = b
c.y = b
c.z = l
j.z = c
j.w = k
a.o = c
a.x = c
a.r = l
b.w = l
b.p = j
b.o = j
b.s = c
h.o = c
h.x = c
h.r = l
k.z = c
k.w = j
l.o = c
l.x = c
l.r = h
f.w = h
f.p = k
f.s = c
f.o = j
assert a.r.o.z.o.y.s.txt == "c"