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

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

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

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

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

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

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

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

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

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

c.p = l
h.q = f
h.y = f
h.t = m
h.x = d
m.v = c
l.y = f
l.s = d
l.r = m
d.p = l
a.y = h
a.s = d
a.r = m
j.v = d
f.q = h
f.y = h
f.t = m
f.x = c
n.v = d
k.y = f
k.s = d
k.r = n
assert d.p.r.v.p.s.p.s.txt == "d"