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

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

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

k = A("k")
e = B("e")
b = C("b")
n = B("n")
c = B("c")
f = C("f")
h = A("h")
i = C("i")
d = C("d")
j = C("j")

k.x = h
k.s = j
e.p = c
e.w = n
e.y = k
b.p = e
b.q = h
b.v = k
n.p = c
n.w = c
n.y = h
c.p = n
c.w = n
c.y = h
f.p = n
f.q = k
f.v = k
h.x = k
h.s = f
i.p = e
i.q = h
i.v = h
d.p = c
d.q = k
d.v = h
j.p = n
j.q = h
j.v = k
assert f.p.y.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
b = C("b")
n = B("n")
c = B("c")
f = C("f")
h = A("h")
i = C("i")
d = C("d")
j = C("j")

k.x = h
k.s = j
e.p = c
e.w = n
e.y = k
b.p = e
b.q = h
b.v = k
n.p = c
n.w = c
n.y = h
c.p = n
c.w = n
c.y = h
f.p = n
f.q = k
f.v = k
h.x = k
h.s = f
i.p = e
i.q = h
i.v = h
d.p = c
d.q = k
d.v = h
j.p = n
j.q = h
j.v = k
assert f.p.y.x.s.txt == "j"