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

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

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

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

c = A("c")
l = B("l")
g = C("g")
h = D("h")
f = A("f")
e = B("e")
d = D("d")
i = C("i")
j = B("j")
b = C("b")

c.r = l
c.y = l
c.v = g
c.o = h
l.w = e
l.p = b
g.y = e
g.x = d
h.s = e
h.o = i
h.t = g
h.w = g
f.r = l
f.y = l
f.v = b
f.o = d
e.w = j
e.p = g
d.s = l
d.o = g
d.t = g
d.w = g
i.y = l
i.x = h
j.w = e
j.p = i
b.y = e
b.x = h
assert g.y.p.y.p.y.w.w.p.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: B = None
        self.v: C = None
        self.o: D = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
g = C("g")
h = D("h")
f = A("f")
e = B("e")
d = D("d")
i = C("i")
j = B("j")
b = C("b")

c.r = l
c.y = l
c.v = g
c.o = h
l.w = e
l.p = b
g.y = e
g.x = d
h.s = e
h.o = i
h.t = g
h.w = g
f.r = l
f.y = l
f.v = b
f.o = d
e.w = j
e.p = g
d.s = l
d.o = g
d.t = g
d.w = g
i.y = l
i.x = h
j.w = e
j.p = i
b.y = e
b.x = h
assert g.y.p.y.p.y.w.w.p.x.s.txt == "l"