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

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

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

h = A("h")
n = B("n")
i = C("i")
j = B("j")
c = A("c")
f = A("f")
g = C("g")
d = B("d")

h.q = i
h.s = c
h.t = j
n.p = j
n.s = j
n.v = g
i.y = j
i.s = g
j.p = n
j.s = n
j.v = i
c.q = i
c.s = h
c.t = n
f.q = i
f.s = h
f.t = d
g.y = n
g.s = i
d.p = n
d.v = i
d.s = j
assert f.s.q.y.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.t: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
i = C("i")
j = B("j")
c = A("c")
f = A("f")
g = C("g")
d = B("d")

h.q = i
h.s = c
h.t = j
n.p = j
n.s = j
n.v = g
i.y = j
i.s = g
j.p = n
j.s = n
j.v = i
c.q = i
c.s = h
c.t = n
f.q = i
f.s = h
f.t = d
g.y = n
g.s = i
d.p = n
d.v = i
d.s = j
assert f.s.q.y.v.y.v.txt == "i"