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

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

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

c = A("c")
d = B("d")
a = C("a")
l = B("l")
j = C("j")
n = C("n")
i = C("i")

c.q = d
c.t = d
d.y = a
a.v = i
a.r = d
a.p = c
l.y = n
j.v = i
j.r = d
j.p = c
n.v = a
n.r = l
n.p = c
i.v = j
i.r = d
i.p = c
assert c.q.y.v.r.y.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
a = C("a")
l = B("l")
j = C("j")
n = C("n")
i = C("i")

c.q = d
c.t = d
d.y = a
a.v = i
a.r = d
a.p = c
l.y = n
j.v = i
j.r = d
j.p = c
n.v = a
n.r = l
n.p = c
i.v = j
i.r = d
i.p = c
assert c.q.y.v.r.y.v.p.txt == "c"