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

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

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

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

c = A("c")
i = B("i")
k = C("k")
n = D("n")
e = A("e")
d = C("d")
a = B("a")
h = A("h")
f = B("f")

c.o = f
c.y = h
c.q = h
c.r = i
i.w = k
i.v = h
k.u = a
n.v = f
e.o = i
e.y = h
e.r = a
e.q = c
d.u = i
a.w = d
a.v = h
h.o = f
h.y = c
h.q = c
h.r = i
f.w = d
f.v = e
assert c.r.v.r.w.u.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: A = None
        self.r: B = None
        self.q: A = None
        self.txt = txt

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

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

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

c = A("c")
i = B("i")
k = C("k")
n = D("n")
e = A("e")
d = C("d")
a = B("a")
h = A("h")
f = B("f")

c.o = f
c.y = h
c.q = h
c.r = i
i.w = k
i.v = h
k.u = a
n.v = f
e.o = i
e.y = h
e.r = a
e.q = c
d.u = i
a.w = d
a.v = h
h.o = f
h.y = c
h.q = c
h.r = i
f.w = d
f.v = e
assert c.r.v.r.w.u.w.u.w.txt == "k"