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

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

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

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

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

d.y = l
d.t = l
d.r = k
d.u = g
m.r = a
e.u = k
e.w = m
e.z = h
e.x = g
a.s = h
a.o = k
l.y = d
l.t = d
l.r = m
l.u = a
k.r = g
b.y = d
b.t = d
b.r = h
b.u = g
h.r = g
g.s = k
g.o = k
c.u = m
c.w = h
c.z = k
c.x = g
assert k.r.o.r.o.r.o.r.s.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.u: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

d.y = l
d.t = l
d.r = k
d.u = g
m.r = a
e.u = k
e.w = m
e.z = h
e.x = g
a.s = h
a.o = k
l.y = d
l.t = d
l.r = m
l.u = a
k.r = g
b.y = d
b.t = d
b.r = h
b.u = g
h.r = g
g.s = k
g.o = k
c.u = m
c.w = h
c.z = k
c.x = g
assert k.r.o.r.o.r.o.r.s.r.o.txt == "k"