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

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

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

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

n.s = i
n.t = i
n.r = l
b.t = g
c.z = b
c.p = i
i.s = n
i.t = d
i.r = b
e.z = l
e.p = d
l.t = c
a.t = g
g.z = l
g.p = d
d.s = n
d.t = i
d.r = l
assert d.t.t.r.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: A = None
        self.r: B = None
        self.txt = txt

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

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

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

n.s = i
n.t = i
n.r = l
b.t = g
c.z = b
c.p = i
i.s = n
i.t = d
i.r = b
e.z = l
e.p = d
l.t = c
a.t = g
g.z = l
g.p = d
d.s = n
d.t = i
d.r = l
assert d.t.t.r.t.z.txt == "b"