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

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

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

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

k = A("k")
c = B("c")
e = C("e")
h = D("h")
l = B("l")
n = D("n")
g = A("g")
f = B("f")
a = C("a")
j = D("j")

k.r = a
k.p = e
c.z = n
c.t = h
c.x = g
e.w = g
e.r = k
e.t = a
h.t = a
h.w = j
h.y = k
l.z = n
l.t = h
l.x = k
n.t = e
n.w = j
n.y = g
g.r = e
g.p = e
f.z = h
f.t = j
f.x = k
a.w = g
a.r = g
a.t = e
j.t = a
j.w = n
j.y = k
assert e.t.w.r.r.r.w.r.t.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
e = C("e")
h = D("h")
l = B("l")
n = D("n")
g = A("g")
f = B("f")
a = C("a")
j = D("j")

k.r = a
k.p = e
c.z = n
c.t = h
c.x = g
e.w = g
e.r = k
e.t = a
h.t = a
h.w = j
h.y = k
l.z = n
l.t = h
l.x = k
n.t = e
n.w = j
n.y = g
g.r = e
g.p = e
f.z = h
f.t = j
f.x = k
a.w = g
a.r = g
a.t = e
j.t = a
j.w = n
j.y = k
assert e.t.w.r.r.r.w.r.t.t.r.txt == "k"