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

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

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

d = A("d")
g = B("g")
l = C("l")
b = C("b")
k = B("k")
h = A("h")
a = C("a")
c = C("c")
e = C("e")
i = C("i")

d.v = g
d.p = h
d.t = c
g.w = l
g.u = d
g.y = d
l.t = h
b.t = h
k.w = b
k.u = h
k.y = h
h.v = k
h.p = d
h.t = a
a.t = h
c.t = d
e.t = h
i.t = h
assert b.t.p.t.t.v.y.t.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: A = None
        self.t: C = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
l = C("l")
b = C("b")
k = B("k")
h = A("h")
a = C("a")
c = C("c")
e = C("e")
i = C("i")

d.v = g
d.p = h
d.t = c
g.w = l
g.u = d
g.y = d
l.t = h
b.t = h
k.w = b
k.u = h
k.y = h
h.v = k
h.p = d
h.t = a
a.t = h
c.t = d
e.t = h
i.t = h
assert b.t.p.t.t.v.y.t.t.v.txt == "g"