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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

c.p = d
c.u = b
c.o = a
e.x = l
g.y = l
g.u = e
g.t = n
g.r = b
l.x = e
n.p = d
n.u = b
n.o = e
a.x = l
i.y = l
i.u = a
i.t = d
i.r = b
b.x = l
d.p = n
d.u = e
d.o = e
assert d.p.p.p.p.p.p.p.u.txt == "b"