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

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

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

c = A("c")
n = B("n")
i = C("i")
b = C("b")
d = A("d")
a = A("a")
l = B("l")
g = B("g")
f = B("f")

c.q = a
c.y = n
n.v = c
n.t = d
i.u = a
b.u = d
d.q = c
d.y = g
a.q = d
a.y = g
l.v = a
l.t = a
g.v = d
g.t = c
f.v = d
f.t = c
assert b.u.q.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: B = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
i = C("i")
b = C("b")
d = A("d")
a = A("a")
l = B("l")
g = B("g")
f = B("f")

c.q = a
c.y = n
n.v = c
n.t = d
i.u = a
b.u = d
d.q = c
d.y = g
a.q = d
a.y = g
l.v = a
l.t = a
g.v = d
g.t = c
f.v = d
f.t = c
assert b.u.q.y.t.txt == "d"