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

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

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

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

k = A("k")
e = B("e")
j = C("j")
n = D("n")
a = A("a")
d = B("d")
c = B("c")

k.s = j
k.u = j
k.t = c
e.q = c
e.r = a
e.t = d
j.p = a
n.o = a
a.s = j
a.u = j
a.t = d
d.q = e
d.r = k
d.t = c
c.q = e
c.t = e
c.r = a
assert c.r.u.p.t.t.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: B = None
        self.u: C = None
        self.txt = txt

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

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

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

k = A("k")
e = B("e")
j = C("j")
n = D("n")
a = A("a")
d = B("d")
c = B("c")

k.s = j
k.u = j
k.t = c
e.q = c
e.r = a
e.t = d
j.p = a
n.o = a
a.s = j
a.u = j
a.t = d
d.q = e
d.r = k
d.t = c
c.q = e
c.t = e
c.r = a
assert c.r.u.p.t.t.t.q.txt == "c"