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

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

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

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

f = A("f")
e = B("e")
j = C("j")
k = D("k")
i = D("i")
h = A("h")
g = C("g")
b = B("b")
a = B("a")

f.w = a
f.t = e
f.r = k
e.u = h
e.p = b
e.r = b
e.s = a
j.t = k
k.x = i
k.s = i
k.v = e
i.x = k
i.s = k
i.v = e
h.w = e
h.t = a
h.r = k
g.t = k
b.u = h
b.p = e
b.s = e
b.r = e
a.u = f
a.p = b
a.s = b
a.r = e
assert b.u.w.p.r.p.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
j = C("j")
k = D("k")
i = D("i")
h = A("h")
g = C("g")
b = B("b")
a = B("a")

f.w = a
f.t = e
f.r = k
e.u = h
e.p = b
e.r = b
e.s = a
j.t = k
k.x = i
k.s = i
k.v = e
i.x = k
i.s = k
i.v = e
h.w = e
h.t = a
h.r = k
g.t = k
b.u = h
b.p = e
b.s = e
b.r = e
a.u = f
a.p = b
a.s = b
a.r = e
assert b.u.w.p.r.p.u.t.txt == "a"