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

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

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

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

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

a.p = b
a.r = k
a.s = n
f.v = a
e.v = j
e.s = f
e.y = f
e.w = d
j.x = f
j.t = f
h.v = j
h.s = f
h.y = f
h.w = d
k.x = f
k.t = f
d.v = j
d.s = f
d.y = f
d.w = b
n.p = b
n.r = j
n.s = a
l.p = h
l.r = j
l.s = a
b.v = j
b.s = f
b.y = f
b.w = h
assert a.r.t.v.p.v.x.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

a.p = b
a.r = k
a.s = n
f.v = a
e.v = j
e.s = f
e.y = f
e.w = d
j.x = f
j.t = f
h.v = j
h.s = f
h.y = f
h.w = d
k.x = f
k.t = f
d.v = j
d.s = f
d.y = f
d.w = b
n.p = b
n.r = j
n.s = a
l.p = h
l.r = j
l.s = a
b.v = j
b.s = f
b.y = f
b.w = h
assert a.r.t.v.p.v.x.v.p.txt == "b"